Skip to content

Commit

Permalink
TEST new pre-release workflow (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
carstingaxion authored Jul 13, 2023
2 parents 1670330 + e9389ba commit febc2b4
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/prerelease-changelog-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: 'pre-Release Changelog Update'

on:
workflow_call:
release:
types: [prereleased]

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
# Push to protected branches
# If your repository uses protected branches you have to make some changes
# to your Workflow for the Action to work properly:
#
# You need a Personal Access Token and you either have to
# a) allow force pushes
# or
# b) the Personal Access Token needs to belong to an Administrator.
#
# Add the following to the 'with:' group: 'token: ${{ secrets.PAT }}'
#
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_TOKEN }}
ref: ${{ github.event.release.target_commitish }}

- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
release-notes: ${{ github.event.release.body }}
latest-version: ${{ github.event.release.tag_name }}

- uses: EndBug/add-and-commit@v9
with:
add: 'CHANGELOG.md'
message: Update changelog to ${{ github.event.release.tag_name }}
# Whether to push the commit and, if any, its tags to the repo. It can also be used to set the git push arguments (see the paragraph below for more info)
# Default: true
push: false
committer_name: Frieda Theodor Automatisierungs-Bot <email-roboter@figuren.theater>
committer_email: email-roboter@figuren.theater

- name: Push to protected branch
uses: CasperWA/push-protected@v2
with:
token: ${{ secrets.BOT_TOKEN }}
branch: ${{ github.event.release.target_commitish }}
unprotect_reviews: true


# @TODO #57 Automatically bump version in all relevant files

# - name: Create Pull Request
# uses: peter-evans/create-pull-request@v3
# with:
# token: ${{ secrets.BOT_TOKEN }}
# commit-message: update changelog
# title: Update Changelog
# body: Update changelog to reflect release changes
# branch: update-changelog
# base: ${{ github.event.release.target_commitish }}

- name: publish pre-Release as Release
uses: actions/github-script@v5
with:
github-token: ${{ secrets.BOT_TOKEN }}
script: |
const { owner, repo } = context.repo;
const release = await github.repos.getReleaseByTag({
owner,
repo,
tag: context.ref.replace('refs/tags/', '')
});
await github.repos.updateRelease({
owner,
repo,
release_id: release.data.id,
draft: false,
prerelease: false
});
File renamed without changes.

0 comments on commit febc2b4

Please sign in to comment.