Docker #266
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: # yamllint disable-line rule:truthy | |
push: ~ | |
workflow_dispatch: ~ | |
schedule: | |
- cron: '0 0 * * SAT' # Monday-Friday at 6:30 AM (AEST) | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
yamllint: | |
runs-on: ubuntu-latest | |
steps: | |
- id: checkout | |
name: Checkout code π | |
uses: actions/checkout@v4 | |
- id: yamllint | |
name: Run yamllint π | |
uses: ibiqlik/action-yamllint@v3 | |
with: | |
strict: true | |
update-doc: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- id: checkout | |
name: Checkout code π | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo | |
- id: auto-doc | |
name: Run auto-doc π | |
uses: tj-actions/auto-doc@v3.5.0 | |
with: | |
filename: "action.yaml" | |
- id: changes | |
name: Verify changed files π | |
uses: tj-actions/verify-changed-files@v20 | |
with: | |
files: | | |
README.md | |
- id: commit | |
if: steps.changes.outputs.files_changed == 'true' | |
name: Commit README changes π₯ | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: 'Update README' | |
committer_name: 'GitHub Actions' | |
committer_email: 'actions@github.com' | |
add: 'README.md' | |
push: | |
runs-on: ubuntu-latest | |
name: Build and Push Container Image | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log into the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata for the Docker image | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
# set latest tag for default branch | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=ref,event=branch | |
type=ref,event=pr | |
- name: Build and push the Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
release: | |
needs: | |
- yamllint | |
- push | |
runs-on: ubuntu-latest | |
if: ${{ github.ref_name == github.event.repository.default_branch }} | |
permissions: | |
contents: write | |
steps: | |
- id: checkout | |
name: Checkout code π | |
uses: actions/checkout@v4 | |
- id: version | |
name: Calculate next version π’ | |
uses: reecetech/version-increment@2024.10.1 | |
with: | |
scheme: semver | |
increment: minor | |
- id: github-release | |
name: Create Github Release π¦ | |
uses: softprops/action-gh-release@v2.2.0 | |
with: | |
tag_name: ${{ steps.version.outputs.v-version }} | |
prerelease: false | |
draft: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- id: push-short-tag | |
name: Create release short tag π· | |
uses: richardsimko/update-tag@v1.0.11 | |
with: | |
tag_name: ${{ steps.version.outputs.major-v-version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: output-version | |
name: Version noted summary page π | |
shell: bash | |
run: | | |
set -euo pipefail | |
echo -e "## β¨ Published\n" | \ | |
tee -a "${GITHUB_STEP_SUMMARY}" | |
echo -e "Name: ${{ github.event.repository.name }}\n" | \ | |
tee -a "${GITHUB_STEP_SUMMARY}" | |
echo -e "Version: ${{ steps.version.outputs.v-version }}\n" | \ | |
tee -a "${GITHUB_STEP_SUMMARY}" | |
echo -e "Moved tag: ${{ steps.version.outputs.major-v-version }}\n" \ | |
| tee -a "${GITHUB_STEP_SUMMARY}" |