Upgrade Node.js (#406) #431
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: Publish Image | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- Dockerfile | |
- Gemfile | |
- Gemfile.lock | |
- entrypoint.sh | |
- .github/workflows/publish-image.yml | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-image: | |
name: Push image to GitHub Container Registry | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }}-publish | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
deployments: write | |
issues: write | |
packages: write | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Login to the container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Start Deployment | |
uses: bobheadxi/deployments@v1 | |
id: deployment | |
with: | |
step: start | |
env: main | |
- name: Extract metadata (tags, labels) of image | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value={{branch}},enable={{is_default_branch}} | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Build and Push Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Update Deployment | |
uses: bobheadxi/deployments@v1 | |
if: always() | |
with: | |
step: finish | |
env: ${{ steps.deployment.outputs.env }} | |
status: ${{ job.status }} | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | |
env_url: https://github.com/HeRoMo/pronto-action/pkgs/container/pronto-action | |
- name: Create Issue on Failure | |
uses: actions/github-script@v7 | |
if: failure() | |
with: | |
script: | | |
const create = await github.rest.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: "Failed to publish image", | |
body: "Automation has failed!\nMore information can be found at:\n - ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | |
assignees: [ | |
'${{ github.repository_owner }}' | |
] | |
}) |