Workflow file for this run
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: Build and push Docker image with release tag | |
on: | |
release: | |
types: | |
- published | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
packages: write | |
contents: write | |
pull-requests: write | |
jobs: | |
# version_update: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout GitHub Action | |
# uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 | |
# - uses: actions4git/setup-git@v1 | |
# - name: Update version in package.json | |
# id: version | |
# run: | | |
# git checkout main | |
# version=$(npm version from-git --no-git-tag-version) | |
# echo "version=$version" >> $GITHUB_OUTPUT | |
# echo "NPM version is $version" | |
# if [ "${{ github.event.release.tag_name }}" != "$version" ]; then | |
# echo "Release tag does not match the expected version." | |
# exit 1 | |
# fi | |
# git add . | |
# git commit --signoff --message $version | |
# - name: Create Pull Request | |
# uses: peter-evans/create-pull-request@v7 | |
# continue-on-error: true | |
# with: | |
# title: '🚀Update version to ${{ steps.version.outputs.version }}' | |
# body: | | |
# This PR updates the version to ${{ steps.version.outputs.version }}. | |
# Use **merge commit** strategy for this PR! | |
# branch: 'version-update-${{ steps.version.outputs.version }}' | |
# delete-branch: true | |
# labels: 'version-update' | |
# base: 'main' | |
# - name: Move tag ${{ steps.version.outputs.version }} to PR | |
# run: | | |
# echo "moving tag ${{ steps.version.outputs.version }}" | |
# git tag --force ${{ steps.version.outputs.version }} | |
# git push origin ${{ steps.version.outputs.version }} --force | |
push_to_ghcr: | |
runs-on: ubuntu-latest | |
# needs: version_update | |
steps: | |
- name: Checkout GitHub Action | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
ghcr.io/${{ github.repository }}-with-proxy | |
labels: | | |
org.opencontainers.image.title=copilot-metrics-viewer | |
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage | |
org.opencontainers.image.source=${{ github.repository }} | |
tags: | | |
type=raw,value=latest,enable=true | |
type=sha | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
push: true |