GitHub Actions Continuous Delivery #35
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: GitHub Actions Continuous Delivery | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
schedule: | |
# Automatically run on every Day | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
buildx: | |
runs-on: 1H1G | |
steps: | |
- | |
name: Checkout | |
uses: actions/[email protected] | |
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/[email protected] | |
- | |
# 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/[email protected] | |
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/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- | |
name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/[email protected] | |
with: | |
context: . | |
build-args: | | |
http_proxy=${{ env.http_proxy }} | |
https_proxy=${{ env.http_proxy }} | |
env.no_proxy=${{ env.no_proxy }} | |
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/riscv64,linux/s390x | |
push: true | |
tags: | | |
snowdreamtech/python:latest | |
snowdreamtech/python:3.12.6 | |
snowdreamtech/python:3.12 | |
snowdreamtech/python:3 | |
ghcr.io/snowdreamtech/python:latest | |
ghcr.io/snowdreamtech/python:3.12.6 | |
ghcr.io/snowdreamtech/python:3.12 | |
ghcr.io/snowdreamtech/python:3 | |