Build, Release, and Publish #47
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, Release, and Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
revision: | |
description: "Git Revision to release" | |
required: true | |
release-version: | |
description: "Specify the version number (overwriting the package.json version)" | |
required: false | |
env: | |
AWS_DEFAULT_REGION: eu-central-1 | |
jobs: | |
create-release: | |
permissions: | |
id-token: write | |
contents: write | |
runs-on: ubuntu-latest | |
outputs: | |
pc_contracts_cli: ${{ steps.set_filename_vars_and_rename.outputs.pc_contracts_cli }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ github.token }} | |
ref: ${{ github.event.inputs.revision }} | |
- name: Acquire AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
- name: Set the version | |
run: | | |
if [ -z "${{ github.event.inputs.release-version }}" ]; then | |
VER=$(jq -r ".version" ./offchain/package.json) | |
echo "VERSION=$VER" >> $GITHUB_ENV | |
else | |
echo "VERSION=${{ github.event.inputs.release-version }}" >> $GITHUB_ENV | |
fi | |
- name: Download artifact from S3 | |
run: | | |
aws s3 cp "s3://pcsc-bucket/${{ github.event.inputs.revision }}.zip" ./pc-contracts-cli-v"${{ env.VERSION }}".zip | |
- name: create changes text | |
run: | | |
if test -f ./.changes/"$VERSION".md ; then | |
cp ./.changes/.md ./release-notes | |
else | |
echo "No changie entry for the version specified" > ./release-notes | |
fi | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body_path: ./release-notes | |
draft: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: ./pc-contracts-cli-v${{ env.VERSION }}.zip | |
name: "v${{ env.VERSION }}" |