-
Notifications
You must be signed in to change notification settings - Fork 3
feat(ci): go release workflow #410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
c5a4c69
a57a3ae
5e04743
528fc55
6fd5ff4
f58d2a2
a1d3de9
a7de76d
df29890
0ff3410
cc0fe91
4706a42
a4386f7
ebecb54
92039fb
cf3dd94
6a8090a
7a41364
2afed4a
9b7121a
8483be5
173a596
907cf4c
f4a124b
7197898
42f0196
6deb467
310e6b4
1aac9c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| name: Go Release | ||
| on: | ||
| pull_request: # TODO REMOVE | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: # TODO remove? | ||
| description: "Version for the go package" | ||
| required: true | ||
| type: string | ||
| level: | ||
| description: | | ||
| The level of version bump to make. | ||
|
|
||
| Possible values: | ||
| - major: Increase the major version (x.0.0) | ||
| - minor: Increase the minor version (x.y.0) | ||
| - patch: Increase the patch version (x.y.z) | ||
| - release: Remove the pre-version (x.y.z) | ||
| - rc: Increase the rc pre-version (x.y.z-rc.M) | ||
| - beta: Increase the beta pre-version (x.y.z-beta.M) | ||
| - alpha: Increase the alpha pre-version (x.y.z-alpha.M) | ||
| type: choice | ||
| required: true | ||
| options: # TODO take from semver cmd | ||
| - major | ||
| - minor | ||
| - patch | ||
| - release | ||
| - rc | ||
| - beta | ||
| - alpha | ||
|
|
||
| jobs: | ||
| prepare-source-archive: | ||
| name: Prepare source archive | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout iota-rust-sdk | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0 | ||
|
|
||
| - name: Archive Go bindings | ||
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | ||
| with: | ||
| name: source | ||
| path: bindings/go/iota_sdk | ||
|
|
||
| prepare-build-archives: | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: macos-latest | ||
| target: x86_64-apple-darwin | ||
| lib: libiota_sdk_ffi.dylib | ||
| folder: darwin-amd64 | ||
| - os: macos-latest | ||
| target: aarch64-apple-darwin | ||
| lib: libiota_sdk_ffi.dylib | ||
| folder: darwin-aarch64 | ||
| - os: ubuntu-latest | ||
| target: x86_64-unknown-linux-gnu | ||
| lib: libiota_sdk_ffi.so | ||
| folder: linux-amd64 | ||
| - os: ubuntu-latest | ||
| target: aarch64-unknown-linux-gnu | ||
| lib: libiota_sdk_ffi.so | ||
| folder: linux-aarch64 | ||
| - os: windows-latest | ||
| target: x86_64-pc-windows-msvc | ||
| lib: iota_sdk_ffi.dll | ||
| folder: windows-amd64 | ||
| - os: windows-latest | ||
| target: aarch64-pc-windows-msvc | ||
| lib: iota_sdk_ffi.dll | ||
| folder: windows-aarch64 | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Checkout iota-rust-sdk | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0 | ||
|
|
||
| - name: Install rust target ${{ matrix.target }} | ||
| run: rustup target add ${{ matrix.target }} | ||
|
|
||
| - name: Install gcc-aarch64-linux-gnu | ||
| if: matrix.target == 'aarch64-unknown-linux-gnu' | ||
| run: | | ||
| sudo apt-get update -y | ||
| sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
|
|
||
| - name: Install gcc-x86-64-linux-gnu | ||
| if: matrix.target == 'x86_64-unknown-linux-gnu' | ||
| run: | | ||
| sudo apt-get update -y | ||
| sudo apt-get install -y gcc-x86-64-linux-gnu g++-x86-64-linux-gnu | ||
|
|
||
| - name: Build ${{ matrix.target }} bindings | ||
| if: matrix.os == 'macos-latest' | ||
| run: RUSTFLAGS="-C link-args=-Wl,-install_name,@rpath/${{ matrix.lib }}" cargo build -p iota-sdk-ffi --lib --release --target ${{ matrix.target }} | ||
|
|
||
| - name: Build ${{ matrix.target }} bindings | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this and the previous step have the same name atm
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It includes the target so they are different |
||
| if: matrix.os == 'ubuntu-latest' | ||
| env: | ||
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/aarch64-linux-gnu-gcc | ||
| CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/x86_64-linux-gnu-gcc | ||
| run: RUSTFLAGS="-C link-args=-Wl,-rpath,$ORIGIN" cargo build -p iota-sdk-ffi --lib --release --target ${{ matrix.target }} | ||
|
|
||
| - name: Build ${{ matrix.target }} bindings | ||
| if: matrix.os == 'windows-latest' | ||
| run: cargo build -p iota-sdk-ffi --lib --release --target ${{ matrix.target }} | ||
|
|
||
| - name: Prepare upload | ||
| run: | | ||
| mkdir -p tmp/lib/${{ matrix.folder }} | ||
| cp target/${{ matrix.target }}/release/${{ matrix.lib }} tmp/lib/${{ matrix.folder }}/${{ matrix.lib }} | ||
|
|
||
| - name: Archive ${{ matrix.target }} bindings | ||
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | ||
| with: | ||
| name: ${{ matrix.target }} | ||
| path: tmp | ||
|
|
||
| release-archives: | ||
| name: Release archives | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - prepare-source-archive | ||
| - prepare-build-archives | ||
| steps: | ||
| - name: Checkout iota-sdk-go | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0 | ||
| with: | ||
| repository: iotaledger/iota-sdk-go | ||
| ssh-key: ${{ secrets.SSH_PRIVATE_KEY_FOR_GO_SDK }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Get latest tag from iota-sdk-go | ||
| id: get-latest-tag | ||
| run: | | ||
| LATEST_TAG=$(git tag --sort=-v:refname | head -n 1) | ||
| if [ -z "$LATEST_TAG" ]; then | ||
| LATEST_TAG="v0.0.0" | ||
| fi | ||
| echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT | ||
| echo "Latest tag: $LATEST_TAG" | ||
|
|
||
| - uses: actions-ecosystem/action-bump-semver@34e334551143a5301f38c830e44a22273c6ff5c5 # v1.0.0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. give that step also a name? (also for other steps down below) |
||
| id: bump-semver | ||
| with: | ||
| current_version: ${{ steps.get-latest-tag.outputs.tag }} | ||
| level: ${{ inputs.level || 'patch' }} # TODO undo | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reminder |
||
|
|
||
| - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | ||
| with: | ||
| merge-multiple: true | ||
|
|
||
| - name: Tag the Go package | ||
| run: | | ||
| git config --global user.email [email protected] | ||
| git config --global user.name github-actions | ||
| git add . | ||
| git commit -m "Update Go bindings to version ${{ steps.bump-semver.outputs.new_version }}" | ||
Thoralf-M marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| git push | ||
| git tag ${{ steps.bump-semver.outputs.new_version }} -m "${{ steps.bump-semver.outputs.new_version }}" | ||
| git push --tags | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do it last, still doing 1 or 2 tests 👍🏻