summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/pull_request.yml1
-rw-r--r--.github/workflows/push.yml56
2 files changed, 33 insertions, 24 deletions
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index 7196d4e..663f437 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -5,7 +5,6 @@ on: [ pull_request, workflow_dispatch ]
5env: 5env:
6 SCCACHE_GHA_ENABLED: "true" 6 SCCACHE_GHA_ENABLED: "true"
7 RUSTC_WRAPPER: "sccache" 7 RUSTC_WRAPPER: "sccache"
8 SQLX_OFFLINE: "true"
9 CARGO_TERM_COLOR: always 8 CARGO_TERM_COLOR: always
10 9
11jobs: 10jobs:
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index d41941b..30edefa 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -1,15 +1,11 @@
1name: build and push 1name: container
2 2
3on: 3on:
4 push: 4 push:
5 branches: [ "main" ] 5 branches:
6 workflow_dispatch: 6 - "main"
7 7 tags:
8env: 8 - "v*.*.*"
9 SCCACHE_GHA_ENABLED: "true"
10 RUSTC_WRAPPER: "sccache"
11 SQLX_OFFLINE: "true"
12 CARGO_TERM_COLOR: always
13 9
14jobs: 10jobs:
15 test: 11 test:
@@ -23,28 +19,42 @@ jobs:
23 - run: cargo check --release 19 - run: cargo check --release
24 - run: cargo clippy --release 20 - run: cargo clippy --release
25 21
26 build: 22 docker:
27 runs-on: ubuntu-latest 23 runs-on: ubuntu-latest
28 needs: test
29 steps: 24 steps:
25 - name: Checkout
26 uses: actions/checkout@v4
27 - name: Docker meta
28 id: meta
29 uses: docker/metadata-action@v5
30 with:
31 # list of Docker images to use as base name for tags
32 images: ghcr.io/fxqnlr/webol
33 # generate Docker tags based on the following events/attributes
34 tags: |
35 type=schedule
36 type=ref,event=branch
37 type=ref,event=pr
38 type=semver,pattern={{version}}
39 type=semver,pattern={{major}}.{{minor}}
40 type=semver,pattern={{major}}
41 type=sha
30 - name: Set up QEMU 42 - name: Set up QEMU
31 uses: docker/setup-qemu-action@v3 43 uses: docker/setup-qemu-action@v3
32 - name: Set up Docker Buildx 44 - name: Set up Docker Buildx
33 uses: docker/setup-buildx-action@v2 45 uses: docker/setup-buildx-action@v3
34 - name: Login to DockerHub 46 - name: Login to GHCR
35 uses: docker/login-action@v2 47 if: github.event_name != 'pull_request'
48 uses: docker/login-action@v3
36 with: 49 with:
37 registry: ghcr.io 50 registry: ghcr.io
38 username: ${{ github.actor }} 51 username: ${{ github.repository_owner }}
39 password: ${{ secrets.GITHUB_TOKEN }} 52 password: ${{ secrets.GITHUB_TOKEN }}
40 - name: Build and push 53 - name: Build and push
41 id: docker_build 54 uses: docker/build-push-action@v5
42 uses: docker/build-push-action@v3
43 with: 55 with:
44 push: true 56 context: .
45 platforms: linux/amd64,linux/arm64 57 platforms: linux/amd64,linux/arm64
46 cache-from: type=gha 58 push: ${{ github.event_name != 'pull_request' }}
47 cache-to: type=gha,mode=max 59 tags: ${{ steps.meta.outputs.tags }}
48 tags: | 60 labels: ${{ steps.meta.outputs.labels }}
49 ghcr.io/fxqnlr/webol:dev-latest
50 ghcr.io/fxqnlr/webol:dev-${{ github.run_number }}