diff options
author | FxQnLr <[email protected]> | 2024-04-11 09:16:21 +0200 |
---|---|---|
committer | FxQnLr <[email protected]> | 2024-04-11 09:16:21 +0200 |
commit | 2476e182f61d209768635e8eca6e75b4acfbd007 (patch) | |
tree | bc70f14cae1760e91369705273904c0de1bfbf75 /.github/workflows/push.yml | |
parent | 69d3e0e6564b416637978a69f0a035066aea4759 (diff) | |
download | webol-2476e182f61d209768635e8eca6e75b4acfbd007.tar webol-2476e182f61d209768635e8eca6e75b4acfbd007.tar.gz webol-2476e182f61d209768635e8eca6e75b4acfbd007.zip |
Change Docker release system
Diffstat (limited to '.github/workflows/push.yml')
-rw-r--r-- | .github/workflows/push.yml | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index bdedfee..30edefa 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml | |||
@@ -1,14 +1,11 @@ | |||
1 | name: build and push | 1 | name: container |
2 | 2 | ||
3 | on: | 3 | on: |
4 | push: | 4 | push: |
5 | branches: [ "main" ] | 5 | branches: |
6 | workflow_dispatch: | 6 | - "main" |
7 | 7 | tags: | |
8 | env: | 8 | - "v*.*.*" |
9 | SCCACHE_GHA_ENABLED: "true" | ||
10 | RUSTC_WRAPPER: "sccache" | ||
11 | CARGO_TERM_COLOR: always | ||
12 | 9 | ||
13 | jobs: | 10 | jobs: |
14 | test: | 11 | test: |
@@ -22,29 +19,42 @@ jobs: | |||
22 | - run: cargo check --release | 19 | - run: cargo check --release |
23 | - run: cargo clippy --release | 20 | - run: cargo clippy --release |
24 | 21 | ||
25 | build: | 22 | docker: |
26 | runs-on: ubuntu-latest | 23 | runs-on: ubuntu-latest |
27 | needs: test | ||
28 | 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 | ||
29 | - name: Set up QEMU | 42 | - name: Set up QEMU |
30 | uses: docker/setup-qemu-action@v3 | 43 | uses: docker/setup-qemu-action@v3 |
31 | - name: Set up Docker Buildx | 44 | - name: Set up Docker Buildx |
32 | uses: docker/setup-buildx-action@v2 | 45 | uses: docker/setup-buildx-action@v3 |
33 | - name: Login to DockerHub | 46 | - name: Login to GHCR |
34 | uses: docker/login-action@v2 | 47 | if: github.event_name != 'pull_request' |
48 | uses: docker/login-action@v3 | ||
35 | with: | 49 | with: |
36 | registry: ghcr.io | 50 | registry: ghcr.io |
37 | username: ${{ github.actor }} | 51 | username: ${{ github.repository_owner }} |
38 | password: ${{ secrets.GITHUB_TOKEN }} | 52 | password: ${{ secrets.GITHUB_TOKEN }} |
39 | - name: Build and push | 53 | - name: Build and push |
40 | id: docker_build | 54 | uses: docker/build-push-action@v5 |
41 | uses: docker/build-push-action@v3 | ||
42 | with: | 55 | with: |
43 | push: true | 56 | context: . |
44 | platforms: linux/amd64,linux/arm64 | 57 | platforms: linux/amd64,linux/arm64 |
45 | cache-from: type=gha | 58 | push: ${{ github.event_name != 'pull_request' }} |
46 | cache-to: type=gha,mode=max | 59 | tags: ${{ steps.meta.outputs.tags }} |
47 | tags: | | 60 | labels: ${{ steps.meta.outputs.labels }} |
48 | ghcr.io/fxqnlr/webol:dev-latest | ||
49 | ghcr.io/fxqnlr/webol:dev-${{ github.run_number }} | ||
50 | ghcr.io/fxqnlr/webol:${{ env.CARGO_PKG_VERSION }} | ||