Merge pull request #247 from iwehf/2.0.6-feature #1
Workflow file for this run
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
# Build the binary release version for Mac | |
name: Release Crynux Node using the tag name | |
# Controls when the action will run. Workflow runs when manually triggered using the UI | |
# or API. | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
RELEASE_VERSION: 2.0.6 | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build-the-docker-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/[email protected] | |
with: | |
tool-cache: false | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: false | |
swap-storage: true | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
context: . | |
push: true | |
file: build/Dockerfile | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
# This workflow contains a single job called "greet" | |
build-the-mac-binary: | |
# The type of runner that the job will run on | |
runs-on: macos-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install the Apple certificate | |
env: | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
run: | | |
# create variables | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
# import certificate from secrets | |
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | |
# create temporary keychain | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
# import certificate to keychain | |
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
- name: Build | |
run: ./build/macos/build.sh -s "${{ secrets.APPLE_DEVELOPER_IDENTITY }}" -u "${{ secrets.APPLE_USER }}" -p "${{ secrets.APPLE_PASS }}" -t "${{ secrets.APPLE_TEAM_ID }}" | |
- name: Upload the artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: mac-app | |
path: build/crynux_node/dist/crynux-node-helium-v${{ env.RELEASE_VERSION }}-mac-arm64-signed.dmg | |
build-the-windows-binary: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Run the build script | |
run: ./build/windows/build.ps1 | |
- id: gdrive | |
name: Upload to gdrive | |
uses: hoatruongdev09/[email protected] | |
with: | |
service-account-json: ${{ secrets.GOOGLE_DRIVE_GSA_CREDENTIALS_BASE64 }} | |
file-path: "build/crynux_node/dist/crynux-node-helium-v${{ env.RELEASE_VERSION }}-windows-x64.zip" | |
upload-name: "crynux-node-helium-v${{ env.RELEASE_VERSION }}-windows-x64.zip" | |
upload-to-folder-id: ${{ secrets.GOOGLE_DRIVE_FOLDER_ID }} | |
outputs: | |
google-drive-link-content: ${{ steps.gdrive.outputs.web-content-link }} | |
google-drive-link-view: ${{ steps.gdrive.outputs.web-view-link }} | |
build-the-linux-binary: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Run the build script | |
run: ./build/linux-server/build.sh | |
- id: gdrive | |
name: Upload to gdrive | |
uses: hoatruongdev09/[email protected] | |
with: | |
service-account-json: ${{ secrets.GOOGLE_DRIVE_GSA_CREDENTIALS_BASE64 }} | |
file-path: "build/crynux_node/dist/crynux-node-helium-v${{ env.RELEASE_VERSION }}-linux-bin-x64.tar.gz" | |
upload-name: "crynux-node-helium-v${{ env.RELEASE_VERSION }}-linux-bin-x64.tar.gz" | |
upload-to-folder-id: ${{ secrets.GOOGLE_DRIVE_FOLDER_ID }} | |
outputs: | |
google-drive-link-content: ${{ steps.gdrive.outputs.web-content-link }} | |
google-drive-link-view: ${{ steps.gdrive.outputs.web-view-link }} | |
publish-release: | |
runs-on: ubuntu-22.04 | |
needs: | |
- build-the-linux-binary | |
- build-the-windows-binary | |
- build-the-mac-binary | |
env: | |
WINDOWS_LINK: ${{ needs.build-the-windows-binary.outputs.google-drive-link-content }} | |
LINUX_LINK: ${{ needs.build-the-linux-binary.outputs.google-drive-link-content }} | |
steps: | |
- name: Print the Google Drive links | |
run: | | |
echo "windows content link: ${{ env.WINDOWS_LINK }}" | |
echo "linux content link: ${{ env.LINUX_LINK }}" | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download mac app | |
uses: actions/download-artifact@v4 | |
with: | |
name: mac-app | |
- name: Print the workspace | |
run: | | |
ls -l | |
- name: Generate the changelog | |
run: | | |
windows_link_escaped=$(printf '%s\n' "${{ env.WINDOWS_LINK }}" | sed -e 's/[\/&]/\\&/g') | |
linux_link_escaped=$(printf '%s\n' "${{ env.LINUX_LINK }}" | sed -e 's/[\/&]/\\&/g') | |
sed -i "s/RELEASE_VERSION/${{ env.RELEASE_VERSION }}/g" build/changelog-template.md | |
sed -i "s/WINDOWS_LINK/$windows_link_escaped/g" build/changelog-template.md | |
sed -i "s/LINUX_SERVER_LINK/$linux_link_escaped/g" build/changelog-template.md | |
- id: release | |
name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: build/changelog-template.md | |
files: crynux-node-helium-v${{ env.RELEASE_VERSION }}-mac-arm64-signed.dmg | |
outputs: | |
windows-link: ${{ env.WINDOWS_LINK }} | |
linux-link: ${{ env.LINUX_LINK }} | |
mac-link: ${{ fromJSON(steps.release.outputs.assets)[0].browser_download_url }} | |
update-documentation: | |
runs-on: ubuntu-22.04 | |
needs: | |
- publish-release | |
env: | |
WINDOWS_LINK: ${{ needs.publish-release.outputs.windows-link }} | |
LINUX_LINK: ${{ needs.publish-release.outputs.linux-link }} | |
MAC_LINK: ${{ needs.publish-release.outputs.mac-link }} | |
steps: | |
- name: Dispatch event to the documentation repository | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.PAT }} | |
repository: ${{ github.repository_owner }}/documentation | |
event-type: node-released | |
client-payload: '{"windows-link": "${{ env.WINDOWS_LINK }}", "linux-link": "${{ env.LINUX_LINK }}", "mac-link": "${{ env.MAC_LINK }}", "release-version": "${{ env.RELEASE_VERSION }}"}' |