Skip to content

chore(deps): update dependabot/fetch-metadata action to v2.3.0 #74

chore(deps): update dependabot/fetch-metadata action to v2.3.0

chore(deps): update dependabot/fetch-metadata action to v2.3.0 #74

Workflow file for this run

# ---------------------------------------------------- #
# Note: this file originates in template-action-docker #
# ---------------------------------------------------- #
on:
- push
- workflow_dispatch
name: push
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
jobs:
metadata:
runs-on: ubuntu-latest
outputs:
image-name: ${{ steps.image.outputs.name }}
repository_is_template: ${{ steps.metadata.outputs.repository_is_template }}
repository_default_branch: ${{ steps.metadata.outputs.repository_default_branch }}
steps:
- uses: actions/[email protected]
- id: metadata
uses: khulnasoft-lab/[email protected]
- id: image
run: echo "name=$(basename "${GITHUB_REPOSITORY/docker-//}")" >> "$GITHUB_OUTPUT"
commit-lint:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: khulnasoft-lab/action-commit-lint@master
with:
config: .github/linters/.commit-lint.yml
mega-linter:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: oxsecurity/megalinter/flavors/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
MEGALINTER_CONFIG: .github/linters/.mega-linter.yml
GITHUB_COMMENT_REPORTER: true
GITHUB_STATUS_REPORTER: true
- uses: actions/upload-artifact@v3
if: ${{ success() }} || ${{ failure() }}
with:
name: mega-linter-reports
path: |
megalinter-reports
mega-linter.log
release:
needs:
- metadata
- commit-lint
- mega-linter
# only runs on main branch for non template repos
if: |
needs.metadata.outputs.repository_is_template == 'false' &&
needs.metadata.outputs.repository_default_branch == github.ref_name
timeout-minutes: 5
runs-on: ubuntu-latest
outputs:
published: ${{ steps.release.outputs.published }}
version: ${{ steps.release.outputs.release-version }}
version-major: ${{ steps.release.outputs.release-version-major }}
version-minor: ${{ steps.release.outputs.release-version-minor }}
steps:
- uses: actions/[email protected]
with:
submodules: true
- id: release
uses: khulnasoft-lab/[email protected]
with:
config: ${{ github.workspace }}/.semantic.json
env:
GITHUB_TOKEN: ${{ github.token }}
publish-docker:
needs:
- release
- metadata
timeout-minutes: 30
if: ${{ needs.release.outputs.published == 'true' }}
name: publish to ghcr.io
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
# login to registry
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# publish
- uses: docker/build-push-action@v6
with:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository_owner }}/${{ needs.metadata.outputs.image-name }}:latest
ghcr.io/${{ github.repository_owner }}/${{ needs.metadata.outputs.image-name }}:${{ needs.release.outputs.version-major }}
ghcr.io/${{ github.repository_owner }}/${{ needs.metadata.outputs.image-name }}:${{ needs.release.outputs.version }}
labels: |
org.opencontainers.image.title=${{ needs.metadata.outputs.image-name }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.version=${{ needs.release.outputs.version }}
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
alias:
needs: release
if: ${{ needs.release.outputs.published == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
release: [ "v${{ needs.release.outputs.version }}" ]
alias:
- "v${{ needs.release.outputs.version-major }}"
- "v${{ needs.release.outputs.version-major }}.${{ needs.release.outputs.version-minor }}"
steps:
- uses: actions/github-script@v6
with:
script: |
const { data: { object: { sha } } } = await github.rest.git.getRef({ ...context.repo, ref: 'tags/${{ matrix.release }}' })
await github.rest.git.deleteRef({ ...context.repo, ref: 'tags/${{ matrix.alias }}' }).catch(() => {})
await github.rest.git.createRef({ ...context.repo, ref: 'refs/tags/${{ matrix.alias }}', sha })
template-sync:
timeout-minutes: 5
needs:
- metadata
- commit-lint
- mega-linter
# only runs on main branch for template repos
if: |
needs.metadata.outputs.repository_is_template == 'true' &&
needs.metadata.outputs.repository_default_branch == github.ref_name
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: khulnasoft/action-template-sync@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}