Skip to content

IPFM-1484: Update actions #1

IPFM-1484: Update actions

IPFM-1484: Update actions #1

Workflow file for this run

name: Create Release
on:
pull_request:
types: [closed]
jobs:
create-release:
runs-on: macos-latest
if: github.event.pull_request.merged == true && github.head_ref == 'create-release'
steps:
- uses: actions/checkout@v4
- name: Get app version
id: get-version
working-directory: Sources
run: |
# expecting Create release <tag-version>
title="${{ github.event.pull_request.title }}"
tag="${title:15}"
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Update tag
uses: scoremedia/update-tag@v2
with:
tag_name: "${{ steps.get-version.outputs.tag }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Changelog
id: get-changelog
run: |
MAC_OS_VERSION=$([[ "$OSTYPE" == "darwin"* ]] && sw_vers -productVersion)
major="$(echo $MAC_OS_VERSION | awk 'BEGIN { FS="." } { print $1 }')"
# For macOS 11 or lower while async/await works, it doesn't seem to work using the precompiled binary
can_run_compiled_binary="$(if [[ $major -lt 12 ]]; then echo 'false'; else echo 'true'; fi)"
if [[ "$OSTYPE" == "darwin"* && "$can_run_compiled_binary" == "true" ]]; then
output=$(./changelog generate --repository=${{ github.repository }} --token=${{ secrets.GITHUB_TOKEN }} --disable-logging)
else
output=$(swift run changelog generate --repository=${{ github.repository }} --token=${{ secrets.GITHUB_TOKEN }} --disable-logging)
fi
# Multiline output is not supported by GitHub Actions
echo 'CHANGELOG_VALUE<<EOF' >> $GITHUB_ENV
echo $output >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo "changelog=$output" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: scoremedia/release-action@v2
with:
tag: "${{ steps.get-version.outputs.tag }}"
body: |
"${{ env.CHANGELOG_VALUE }}"
generateReleaseNotes: true
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "changelog"