Skip to content

fix: use GitHub App token when authed with GitHub App (#257) #6

fix: use GitHub App token when authed with GitHub App (#257)

fix: use GitHub App token when authed with GitHub App (#257) #6

Workflow file for this run

---
name: Release
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: read
jobs:
create_release:
outputs:
full-tag: ${{ steps.release-drafter.outputs.tag_name }}
short-tag: ${{ steps.get_tag_name.outputs.SHORT_TAG }}
body: ${{ steps.release-drafter.outputs.body }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
steps:
- uses: release-drafter/release-drafter@v6
id: release-drafter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
config-name: release-drafter.yml
publish: true
- name: Get the short tag
id: get_tag_name
run: |
short_tag=$(echo ${{ steps.release-drafter.outputs.tag_name }} | cut -d. -f1)
echo "SHORT_TAG=$short_tag" >> $GITHUB_OUTPUT
create_action_images:
needs: create_release
runs-on: ubuntu-latest
permissions:
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: github/issue_metrics # different than repo name (underscore instead of dash)
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Push Docker Image
if: ${{ success() }}
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create_release.outputs.full-tag }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create_release.outputs.short-tag }}
platforms: linux/amd64
provenance: false
sbom: false
create_discussion:
needs: create_release
runs-on: ubuntu-latest
permissions:
discussions: write
steps:
- name: Create an announcement discussion for release
uses: abirismyname/create-discussion@v1.2.0
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: ${{ needs.create_release.outputs.full-tag }}
body: ${{ needs.create_release.outputs.body }}
repository-id: ${{ secrets.RELEASE_DISCUSSION_REPOSITORY_ID }}
category-id: ${{ secrets.RELEASE_DISCUSSION_CATEGORY_ID }}