Docker-aarch64 #262
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: Docker-aarch64 | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
branches: [ "main", "gh_actions", "feat/*", "dev" ] | |
tags: [ 'v*.*.*' ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository_owner }}/guestfish | |
jobs: | |
build-aarch64: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install cosign | |
if: github.event_name != 'pull_request' | |
uses: sigstore/cosign-installer@f3c664df7af409cb4873aa5068053ba9d61a57b6 #v2.6.0 | |
with: | |
cosign-release: 'v1.13.1' | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image to latest | |
id: build-and-push-latest | |
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ghcr.io/${{ github.repository_owner }}/guestfish:latest | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
platforms: linux/aarch64 | |
if: github.ref_name == 'main' | |
- name: Build and push Docker image to test | |
id: build-and-push-test | |
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
platforms: linux/aarch64 | |
if: github.ref_name != 'main' | |
- name: Sign the published Docker image (latest) | |
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'main' }} | |
env: | |
COSIGN_EXPERIMENTAL: "true" | |
run: echo "ghcr.io/${{ github.repository_owner }}/guestfish:latest" | xargs -I {} cosign sign {}@${{ steps.build-and-push-latest.outputs.digest }} | |
- name: Sign the published Docker image (testing) | |
if: ${{ github.event_name != 'pull_request' && github.ref_name != 'main' }} | |
env: | |
COSIGN_EXPERIMENTAL: "true" | |
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push-test.outputs.digest }} |