docker #101
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
publish_type: | |
description: 'What type of image the job should publish' | |
required: false | |
default: 'release' | |
type: choice | |
options: | |
- release | |
- beta | |
schedule: | |
- cron: '0 1 * * *' | |
jobs: | |
publish: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 100 | |
- name: Configure git | |
run: | | |
git config --global user.name "$GITHUB_ACTOR" | |
git config --global user.email "[email protected]" | |
- name: Extract version | |
run: | | |
PKG_VERSION=$(cat VERSION | head -1) | |
echo "PKG_VERSION=$PKG_VERSION" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
buildkitd-flags: --debug | |
driver-opts: image=moby/buildkit:latest | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
logout: false | |
- name: Build and push release image | |
if: ${{inputs.publish_type == 'release'}} | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: "ghcr.io/${{ github.event.repository.owner.login }}/argo-workflows-aws-plugin:v${{ env.PKG_VERSION }},\ | |
ghcr.io/${{ github.event.repository.owner.login }}/argo-workflows-aws-plugin:latest" | |
platforms: linux/amd64,linux/arm64 | |
cache-from: "type=registry,\ | |
ref=ghcr.io/${{ github.event.repository.owner.login }}/argo-workflows-aws-plugin:latest" | |
cache-to: type=inline | |
- name: Build and push beta image | |
if: ${{ (github.event_name == 'schedule') || (inputs.publish_type == 'beta') }} | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: "ghcr.io/${{ github.event.repository.owner.login }}/argo-workflows-aws-plugin:beta" | |
platforms: linux/amd64,linux/arm64 | |
cache-from: "type=registry,\ | |
ref=ghcr.io/${{ github.event.repository.owner.login }}/argo-workflows-aws-plugin:beta" | |
cache-to: type=inline |