Merge pull request #49 from reecetech/dependabot/github_actions/softp… #134
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/[email protected] | |
with: | |
filename: "action.yaml" | |
- id: changes | |
name: Verify changed files 🔎 | |
uses: tj-actions/[email protected] | |
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: '[email protected]' | |
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@v5 | |
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/[email protected] | |
with: | |
scheme: semver | |
increment: minor | |
- id: github-release | |
name: Create Github Release 📦 | |
uses: softprops/[email protected] | |
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/[email protected] | |
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}" |