Publish Registry to ghcr.io #82
This file contains hidden or 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: Publish Registry to ghcr.io | |
env: | |
DOCKER_TAG: ghcr.io/arifai/flutter | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
required: true | |
description: 'Flutter version, eg: 3.16.4 or 3.18.0-0.1.pre (beta channel). Reference: https://docs.flutter.dev/release/archive?tab=linux' | |
channel: | |
type: choice | |
required: true | |
description: 'Flutter channel is only available Stable and Beta. Reference: https://docs.flutter.dev/release/archive?tab=linux' | |
options: | |
- stable | |
- beta | |
jobs: | |
flutter: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ${{ github.ref }} Branch in ${{ github.repository }} Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build ${{ github.repository }} stable channel and push to ghcr.io | |
if: ${{ inputs.channel == 'stable' }} | |
run: | | |
docker build -t $DOCKER_TAG:${{ inputs.channel }} -t $DOCKER_TAG:${{ inputs.version }} \ | |
-t $DOCKER_TAG:latest --build-arg FLUTTER_CHANNEL=${{ inputs.channel }} --build-arg FLUTTER_VERSION=${{ inputs.version }}-${{ inputs.channel }} \ | |
--no-cache -f sdk/Dockerfile . | |
docker push $DOCKER_TAG --all-tags | |
- name: Build ${{ github.repository }} beta channel and push to ghcr.io | |
if: ${{ inputs.channel == 'beta' }} | |
run: | | |
docker build -t $DOCKER_TAG:${{ inputs.channel }} -t $DOCKER_TAG:${{ inputs.version }} \ | |
--build-arg FLUTTER_CHANNEL=${{ inputs.channel }} --build-arg FLUTTER_VERSION=${{ inputs.version }}-${{ inputs.channel }} \ | |
--no-cache -f sdk/Dockerfile . | |
docker push $DOCKER_TAG --all-tags |