Skip to content

Commit

Permalink
separate solana and svm releases
Browse files Browse the repository at this point in the history
  • Loading branch information
nhanphan committed Jan 14, 2025
1 parent 37566c4 commit 9dfc1d3
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 25 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/build-programs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,20 @@ jobs:
run: ./build.sh
env:
PROGRAMS: ${{ env.PROGRAMS }}

- name: Sanitize Ref
id: sanitize
shell: bash
run: |
REF="${{ inputs.git_ref }}"
if [ -z "$REF" ]; then
REF="default"
fi
SANITIZED=${REF//\//-}
echo "sanitized=$SANITIZED" >> "$GITHUB_OUTPUT"
- name: Upload program builds
uses: actions/upload-artifact@v4
with:
name: program-builds-${{ inputs.git_ref }}
name: program-builds-${{ steps.sanitize.outputs.sanitized }}
# First wildcard ensures exported paths are consistently under the programs folder.
path: ./program*/.bin/*.so
include-hidden-files: true
Expand Down
60 changes: 41 additions & 19 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
name: Create release

on:
workflow_dispatch:
workflow_call:
inputs:
program:
description: Program
required: true
default: bubblegum
type: choice
options:
- bubblegum
type: string
type:
description: Type of release
required: true
default: solana
type: string
bump:
description: Version bump
description: Version bump (patch, minor, major)
required: true
default: patch
type: choice
options:
- patch
- minor
- major
type: string
git_ref:
description: Commit hash or branch to create release
required: false
type: string
default: main


env:
CACHE: true
Expand All @@ -42,7 +39,7 @@ jobs:
uses: ./.github/workflows/test-programs.yml
secrets: inherit
with:
program_matrix: '["mpl-${{ inputs.program }}"]'
program_matrix: '["${{ inputs.program }}"]'
git_ref: ${{ inputs.git_ref }}

test_js:
Expand Down Expand Up @@ -75,7 +72,19 @@ jobs:
- name: Bump Program Version
run: |
git fetch --tags --all
VERSION=`git tag -l --sort -version:refname "release/${{ inputs.program }}@*" | head -n 1 | sed 's|release/${{ inputs.program }}@||'`
if [ "${{ inputs.type }}" == "solana" ]; then
TAG_NAME="release/${{ inputs.program }}"
elif [ "${{ inputs.type }}" == "svm" ]; then
TAG_NAME="release/${{ inputs.program }}-svm"
elif [ "${{ inputs.type }}" == "commit" ]; then
COMMIT_SHORTENED=`echo ${{ inputs.git_ref }} | cut -c1-7`
TAG_NAME="release/${{ inputs.program }}-${COMMIT_SHORTENED}"
else
echo "Invalid type: ${{ inputs.type }}"
exit 1
fi
VERSION=`git tag | grep '^release/${{ inputs.program }}' | sort -t@ -k2 -V | tail -n1 | cut -d@ -f2`
MAJOR=`echo ${VERSION} | cut -d. -f1`
MINOR=`echo ${VERSION} | cut -d. -f2`
PATCH=`echo ${VERSION} | cut -d. -f3`
Expand All @@ -94,26 +103,39 @@ jobs:
PROGRAM_VERSION="${MAJOR}.${MINOR}.${PATCH}"
echo PROGRAM_VERSION="${PROGRAM_VERSION}" >> $GITHUB_ENV
echo TAG_NAME="${TAG_NAME}" >> $GITHUB_ENV
echo COMMIT_SHORTENED="${COMMIT_SHORTENED}" >> $GITHUB_ENV
- name: Sanitize Ref
id: sanitize
shell: bash
run: |
REF="${{ inputs.git_ref }}"
if [ -z "$REF" ]; then
REF="default"
fi
SANITIZED=${REF//\//-}
echo "sanitized=$SANITIZED" >> "$GITHUB_OUTPUT"
- name: Download Program Builds
uses: actions/download-artifact@v4
with:
name: program-builds-${{ inputs.git_ref }}
name: program-builds-${{ steps.sanitize.outputs.sanitized }}

- name: Identify Program
run: |
echo PROGRAM_NAME="mpl_core" >> $GITHUB_ENV
echo PROGRAM_NAME="${{ inputs.program }}" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release/${{ inputs.program }}@${{ env.PROGRAM_VERSION }}
release_name: ${{ inputs.program }} v${{ env.PROGRAM_VERSION }}
tag_name: ${{ env.TAG_NAME }}@${{ env.PROGRAM_VERSION }}
release_name: ${{ env.TAG_NAME }}@${{ env.PROGRAM_VERSION }}
body: |
Release ${{ inputs.program }} v${{ env.PROGRAM_VERSION }}
Release ${{ env.TAG_NAME }}@${{ env.PROGRAM_VERSION }}
draft: false
prerelease: false

Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/create-solana-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Create Solana release

on:
workflow_dispatch:
inputs:
bump:
description: Version bump
required: true
default: patch
type: choice
options:
- patch
- minor
- major
git_ref:
description: Commit hash or branch to create release
required: false
type: string
default: main

env:
CACHE: true

jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Create release
uses: ./.github/workflows/create-release.yml
with:
git_ref: ${{ inputs.git_ref }}
bump: ${{ inputs.bump }}
program: bubblegum
type: solana
35 changes: 35 additions & 0 deletions .github/workflows/create-svm-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Create SVM release

on:
workflow_dispatch:
inputs:
bump:
description: Version bump
required: true
default: patch
type: choice
options:
- patch
- minor
- major
git_ref:
description: Commit hash or branch to create release
required: false
type: string
default: svm

env:
CACHE: true

jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Create release
uses: ./.github/workflows/create-release.yml
with:
git_ref: ${{ inputs.git_ref }}
bump: ${{ inputs.bump }}
program: bubblegum
type: svm
19 changes: 15 additions & 4 deletions .github/workflows/deploy-program.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ jobs:
- name: Check tag
id: set_program
run: |
echo program="bubblegum" >> $GITHUB_OUTPUT
if [[ "${{ inputs.git_ref }}" =~ ^release/bubblegum@* ]]; then
echo program="${{ inputs.program }}" >> $GITHUB_OUTPUT
if [[ "${{ inputs.git_ref }}" =~ ^release/${{ inputs.program }}* ]]; then
echo type="release" >> $GITHUB_OUTPUT
else
echo type="ref" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
- name: Identify program
run: |
echo PROGRAM_NAME="bubblegum" >> $GITHUB_ENV
echo PROGRAM_NAME="${{ inputs.program }}" >> $GITHUB_ENV
echo ${{ secrets.BUBBLEGUM_ID }} > ./program-id.json
if [[ "${{ inputs.cluster }}" == "sonic"* ]]; then
Expand All @@ -175,11 +175,22 @@ jobs:
exit 1
fi
- name: Sanitize Ref
id: sanitize
shell: bash
run: |
REF="${{ inputs.git_ref }}"
if [ -z "$REF" ]; then
REF="default"
fi
SANITIZED=${REF//\//-}
echo "sanitized=$SANITIZED" >> "$GITHUB_OUTPUT"
- name: Download program builds
uses: actions/download-artifact@v4
if: needs.check_tag.outputs.type == 'ref'
with:
name: program-builds-${{ inputs.git_ref }}
name: program-builds-${{ steps.sanitize.outputs.sanitized }}

- name: Deploy program
if: github.event.inputs.dry_run == 'false' && env.DEPLOY_TYPE == 'direct'
Expand Down

0 comments on commit 9dfc1d3

Please sign in to comment.