Release workflow #38
This file contains hidden or 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: Release workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
description: "Version to produce" | |
required: true | |
draft: | |
description: "Draft" | |
required: true | |
type: boolean | |
default: true | |
prerelease: | |
description: "Pre-release" | |
required: true | |
type: boolean | |
default: false | |
generate_release_notes: | |
description: "Generate release notes" | |
required: true | |
type: boolean | |
default: true | |
jobs: | |
check-manifest: | |
name: Check the Manifest | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check the manifest version | |
if: ${{ inputs.tag_name != '' }} | |
run: | | |
sudo apt-get install -y jq | |
version=$(jq -r '.version' manifest.json) | |
tag_name=${{ inputs.tag_name }} | |
tag_name_without_v=${tag_name#v} | |
if [[ $version != $tag_name_without_v ]]; then | |
echo "The manifest version is not equal to the tag version" | |
exit 1 | |
fi | |
build-plugin: | |
name: Build node manager plugin | |
uses: ./.github/workflows/build.yml | |
secrets: inherit | |
with: | |
tag_name: ${{ github.event.inputs.tag_name }} | |
zip-package: | |
name: Create zip | |
needs: build-plugin | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-24.04 | |
target: windows | |
ext: .exe | |
arch: amd64 | |
- os: ubuntu-24.04 | |
target: linux | |
arch: amd64 | |
- os: macos-13 | |
target: darwin | |
arch: amd64 | |
- os: macos-13 | |
target: darwin | |
arch: arm64 | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: write | |
id-token: write | |
env: | |
TARGET_NAME: node-manager-plugin_${{ matrix.target }}-${{ matrix.arch }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Task | |
uses: arduino/setup-task@v1 | |
with: | |
version: 3.x | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Load Node bin folders | |
run: | | |
if [ ${{ matrix.target }} == 'windows' ]; then | |
task ci-setup-windows-node-with-unix | |
else | |
task setup-node-folder | |
fi | |
env: | |
OS: ${{ matrix.target }} | |
ARCH: ${{ matrix.arch }} | |
- name: Download plugin binary artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: ${{ env.TARGET_NAME }} | |
- name: make bin executable | |
run: | | |
chmod +x ${{ env.TARGET_NAME }}/* | |
- name : zip package | |
shell: bash | |
run: | | |
zip -j ${{ env.TARGET_NAME }}.zip web/public/favicon.svg manifest.json ${{ env.TARGET_NAME }}/* | |
cd build && zip -r ../${{ env.TARGET_NAME }}.zip node-massa | |
- name: Notarize zip for MacOS ${{ matrix.arch }} | |
uses: massalabs/massa/.github/actions/notarize-macos@ccc3f02e34544f722634a6fb7732cc4bb515e90b | |
if: matrix.target == 'darwin' | |
with: | |
paths: "${{ env.TARGET_NAME }}.zip" | |
apple-id: ${{ secrets.APPLE_ID }} | |
apple-team-id: ${{ secrets.APPLE_TEAM_ID }} | |
apple-app-password: ${{ secrets.APPLE_APP_PASSWORD }} | |
- name: Upload zip package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-zip-node-manager-plugin_${{ matrix.target }}-${{ matrix.arch }} | |
path: | | |
${{ env.TARGET_NAME }}.zip | |
create-release: | |
name: Create release | |
needs: [check-manifest, zip-package] | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download zip package | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: 'release-zip-node-manager-plugin_*' | |
merge-multiple: true | |
- name: Create release and upload binaries | |
uses: softprops/action-gh-release@v1 | |
with: | |
target_commitish: ${{ github.sha }} | |
tag_name: ${{ inputs.tag_name }} | |
draft: ${{ inputs.draft }} | |
prerelease: ${{ inputs.prerelease }} | |
generate_release_notes: ${{ inputs.generate_release_notes }} | |
files: | | |
*.zip | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: eu-west-3 | |
aws-access-key-id: ${{ secrets.MS_S3_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.MS_S3_SECRET_ACCESS_KEY }} | |
- name: s3 Upload | |
env: | |
AWS3: ${{ vars.MS_S3_BUCKET }} | |
TAG: ${{ inputs.tag_name }} | |
run: | | |
for file in *.zip; do | |
echo "Uploading $file to s3://${AWS3}/plugins/node-manager/${TAG}/" | |
aws s3 cp "$file" s3://${AWS3}/plugins/node-manager/${TAG}/ | |
done | |