Split Github Actions into ci and release steps.

This commit is contained in:
bertybuttface 2023-06-18 12:44:54 +01:00
parent 560d94410a
commit c059381f57
2 changed files with 33 additions and 10 deletions

31
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build Docker Image
uses: docker/build-push-action@v3
with:
context: .
push: false
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
# -
# name: Run Tests
# run: |
# # Add commands to run your tests here

View File

@ -1,11 +1,9 @@
name: ci
name: release
on:
push:
tags:
- "v*.*.*"
branches: [main]
pull_request:
branches: [main]
jobs:
@ -20,15 +18,10 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/matrixgpt/matrix-chatgpt-bot
flavor: latest=true
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
@ -41,7 +34,6 @@ jobs:
uses: docker/setup-buildx-action@v2
-
name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
@ -52,7 +44,7 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.ref_type == 'tag' }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64