Bump docker/build-push-action from 4 to 5 #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Static Build | |
on: | |
push: | |
branches: | |
- main | |
- release-* | |
tags: | |
# YYYYMMDD | |
- "20[0-9][0-9][0-1][0-9][0-3][0-9]*" | |
schedule: | |
- cron: "0 0 * * 1" | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
static-build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- amd | |
- arm | |
steps: | |
- name: Prepare AMD | |
if: ${{ matrix.arch == 'amd' }} | |
run: | | |
echo "TARGET=x86_64-unknown-linux-musl" >> $GITHUB_ENV | |
echo "DEVSHELL=.#crossShell" >> $GITHUB_ENV | |
- name: Prepare ARM | |
if: ${{ matrix.arch == 'arm' }} | |
run: | | |
echo "TARGET=aarch64-unknown-linux-musl" >> $GITHUB_ENV | |
echo "DEVSHELL=.#armCrossShell" >> $GITHUB_ENV | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: cachix/install-nix-action@v22 | |
- uses: cachix/cachix-action@v12 | |
# If PR is from a non-collaborator (e. g. dependabot) the secrets are missing and the login to cachix fails. | |
continue-on-error: true | |
with: | |
name: espresso-systems-private | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
extraPullNames: nix-community | |
- name: Cache cargo | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
~/.cargo/git | |
target | |
key: discord-faucet-static-${{matrix.arch}}-v0-${{ hashFiles('Cargo.lock') }} | |
- name: Fix Git Security Issue | |
run: git config --global --add safe.directory "$PWD" | |
- name: Compile all executables | |
# timeout-minutes: 120 | |
run: | | |
nix develop $DEVSHELL --accept-flake-config --option sandbox relaxed -c cargo build --release | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.TARGET }}-services | |
path: | | |
target/${{ env.TARGET }}/release/discord-faucet | |
static-dockers: | |
runs-on: ubuntu-latest | |
needs: static-build | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Download executables AMD | |
uses: actions/download-artifact@v3 | |
with: | |
name: x86_64-unknown-linux-musl-services | |
path: target/amd64/release | |
- name: Download executables ARM | |
uses: actions/download-artifact@v3 | |
with: | |
name: aarch64-unknown-linux-musl-services | |
path: target/arm64/release | |
- name: Setup Docker BuildKit (buildx) | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Github Container Repo | |
uses: docker/login-action@v2 | |
if: github.event_name != 'pull_request' | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate discord-faucet docker metadata | |
uses: docker/metadata-action@v5 | |
id: discord-faucet | |
with: | |
images: ghcr.io/espressosystems/discord-faucet | |
- name: Build and push discord-faucet docker | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: Dockerfile | |
platforms: linux/amd64,arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.discord-faucet.outputs.tags }} | |
labels: ${{ steps.discord-faucet.outputs.labels }} |