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