CI #7
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: ci | |
on: | |
workflow_dispatch: # Allows manual execution | |
schedule: | |
- cron: "0 0 1 * *" # Runs on the 1st of every month | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Determine CalVer version | |
id: calver | |
run: echo "CALVER=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT | |
- name: Display CalVer | |
run: echo "CalVer version ${{ steps.calver.outputs.CALVER }}" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 | |
context: . | |
push: true | |
tags: | | |
ghcr.io/${{ github.actor }}/caddy-docker-proxy-cloudflare:latest | |
ghcr.io/${{ github.actor }}/caddy-docker-proxy-cloudflare:${{ steps.calver.outputs.CALVER }} | |
- name: Create tag | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/${{ steps.calver.outputs.CALVER }}', | |
sha: context.sha | |
}) |