GitHub Actions Continuous Delivery (Alpine) #190
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: GitHub Actions Continuous Delivery (Alpine) | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| - "dev" | |
| - "feat/**" | |
| - "feature/**" | |
| - "fix/**" | |
| - "pr/**" | |
| tags: | |
| - "[0-9]+.[0-9]+.[0-9]+" | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| - "V[0-9]+.[0-9]+.[0-9]+" | |
| - "alpine-[0-9]+.[0-9]+.[0-9]+" | |
| - "[0-9]+.[0-9]+" | |
| - "v[0-9]+.[0-9]+" | |
| - "V[0-9]+.[0-9]+" | |
| - "alpine-[0-9]+.[0-9]+" | |
| - "[0-9]+" | |
| - "v[0-9]+" | |
| - "V[0-9]+" | |
| - "alpine-[0-9]+" | |
| pull_request: | |
| branches: | |
| - "main" | |
| - "dev" | |
| - "feat/**" | |
| - "feature/**" | |
| - "fix/**" | |
| - "pr/**" | |
| schedule: | |
| # Automatically run on every Day | |
| - cron: "18 17 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| buildx: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # - name: Bypass Cloudflare for Github Action Pro | |
| # uses: snowdreamtech/bypass-cloudflare-for-github-action@v0.0.4 | |
| # with: | |
| # mode: 'list' | |
| # cf_account_id: ${{ secrets.CF_ACCOUNT_ID }} | |
| # cf_api_token: ${{ secrets.CF_API_TOKEN }} | |
| # cf_zone_id: ${{ secrets.CF_ZONE_ID }} | |
| # github_api_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@v1.3.1 | |
| with: | |
| # this might remove tools that are actually needed, | |
| # if set to "true" but frees about 6 GB | |
| tool-cache: false | |
| # all of these default to true, but feel free to set to | |
| # "false" if necessary for your workflow | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: false | |
| swap-storage: false | |
| - name: Checkout | |
| uses: actions/checkout@v4.2.2 | |
| with: | |
| # [Required] Access token with `workflow` scope. | |
| token: ${{ secrets.WORKFLOW_SECRET }} | |
| - name: Set env variables | |
| run: | | |
| echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
| echo "http_proxy=${http_proxy}" >> $GITHUB_ENV | |
| echo "no_proxy=${no_proxy}" >> $GITHUB_ENV | |
| - # Add support for more platforms with QEMU (optional) | |
| # https://github.com/docker/setup-qemu-action | |
| name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3.6.0 | |
| - # https://github.com/docker/setup-buildx-action/issues/57#issuecomment-1059657292 | |
| # https://github.com/docker/buildx/issues/136#issuecomment-550205439 | |
| # docker buildx create --driver-opt env.http_proxy=$http_proxy --driver-opt env.https_proxy=$https_proxy --driver-opt '"env.no_proxy='$no_proxy'"' | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3.10.0 | |
| with: | |
| buildkitd-config: .github/buildkitd.toml | |
| driver-opts: | | |
| env.http_proxy=${{ env.http_proxy }} | |
| env.https_proxy=${{ env.http_proxy }} | |
| "env.no_proxy='${{ env.no_proxy}}'" | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3.4.0 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Login to Quay.io | |
| uses: docker/login-action@v3.4.0 | |
| with: | |
| registry: quay.io | |
| username: ${{ secrets.QUAY_USERNAME }} | |
| password: ${{ secrets.QUAY_ROBOT_TOKEN }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3.4.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5.7.0 | |
| with: | |
| images: | | |
| name=snowdreamtech/openjdk,enable=true | |
| name=snowdreamtech/java,enable=true | |
| name=ghcr.io/snowdreamtech/openjdk,enable=true | |
| name=ghcr.io/snowdreamtech/java,enable=true | |
| name=quay.io/snowdreamtech/openjdk,enable=true | |
| name=quay.io/snowdreamtech/java,enable=true | |
| flavor: | | |
| latest=false | |
| prefix= | |
| suffix= | |
| tags: | | |
| type=ref,enable=${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' && github.event_name != 'schedule' }},priority=600,prefix=,suffix=,event=branch | |
| type=edge,enable=true,priority=700,prefix=,suffix=,branch=dev | |
| type=raw,enable=${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.event_name != 'schedule' }},priority=200,prefix=,suffix=,value=latest | |
| type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=latest | |
| type=schedule,enable=true,priority=1000,prefix=,suffix=,pattern=nightly | |
| type=match,enable=true,priority=800,prefix=,suffix=,pattern=\d+.\d+.\d+,group=0,value= | |
| type=match,enable=true,priority=800,prefix=,suffix=,pattern=\d+.\d+,group=0,value= | |
| type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/alpine-0.') && !startsWith(github.ref, 'refs/tags/alpine-v0.') && !startsWith(github.ref, 'refs/tags/alpine-V0.') }},priority=800,prefix=,suffix=,pattern=\d+,group=0,value= | |
| type=ref,enable=${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' && github.event_name != 'schedule' }},priority=600,prefix=,suffix=-alpine,event=branch | |
| type=edge,enable=true,priority=700,prefix=,suffix=-alpine,branch=dev | |
| type=raw,enable=${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.event_name != 'schedule' }},priority=200,prefix=,suffix=,value=alpine | |
| type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=alpine | |
| type=schedule,enable=true,priority=1000,prefix=,suffix=-alpine,pattern=nightly | |
| type=match,enable=true,priority=800,prefix=,suffix=-alpine,pattern=\d+.\d+.\d+,group=0,value= | |
| type=match,enable=true,priority=800,prefix=,suffix=-alpine,pattern=\d+.\d+,group=0,value= | |
| type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/alpine-0.') && !startsWith(github.ref, 'refs/tags/alpine-v0.') && !startsWith(github.ref, 'refs/tags/alpine-V0.') }},priority=800,prefix=,suffix=-alpine,pattern=\d+,group=0,value= | |
| type=ref,enable=${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' && github.event_name != 'schedule' }},priority=600,prefix=,suffix=-alpine3.21,event=branch | |
| type=edge,enable=true,priority=700,prefix=,suffix=-alpine3.21,branch=dev | |
| type=raw,enable=${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.event_name != 'schedule' }},priority=200,prefix=,suffix=,value=alpine3.21 | |
| type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=alpine3.21 | |
| type=schedule,enable=true,priority=1000,prefix=,suffix=-alpine3.21,pattern=nightly | |
| type=match,enable=true,priority=800,prefix=,suffix=-alpine3.21,pattern=\d+.\d+.\d+,group=0,value= | |
| type=match,enable=true,priority=800,prefix=,suffix=-alpine3.21,pattern=\d+.\d+,group=0,value= | |
| type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/alpine-0.') && !startsWith(github.ref, 'refs/tags/alpine-v0.') && !startsWith(github.ref, 'refs/tags/alpine-V0.') }},priority=800,prefix=,suffix=-alpine3.21,pattern=\d+,group=0,value= | |
| env: | |
| DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index | |
| - name: Build and push | |
| uses: docker/build-push-action@v6.16.0 | |
| with: | |
| context: alpine | |
| build-args: | | |
| "http_proxy=${{ env.http_proxy }}" | |
| "https_proxy=${{ env.http_proxy }}" | |
| BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} | |
| VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} | |
| REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} | |
| platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/riscv64,linux/s390x | |
| # platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/riscv64,linux/s390x | |
| push: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/heads/feat/') && !startsWith(github.ref, 'refs/heads/feature/') && !startsWith(github.ref, 'refs/heads/fix/') && !startsWith(github.ref, 'refs/heads/pr/') }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| annotations: ${{ steps.meta.outputs.annotations }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |