Skip to content

Commit

Permalink
chore: update build actions before deprecation (#2705)
Browse files Browse the repository at this point in the history
* remove rust toolchain

* update setup-python

* update upload release asset

Co-authored-by: Jean Ribeiro <[email protected]>

* set version

* comment out win + mac

* incr version

* remove mac code

* fix updater file

* clobber

* cleanup uploading to release

* test linux

* uncomment all OS

* incr version

* change release name

* incr version

* use github script

* remoe old linux code

* fix github script

* fix github script

* create release script

* fix

* fix typo

* test

* fix upload url

* log upload path

* test

* fix return value

* revert old changes

* revert version

---------

Co-authored-by: Jean Ribeiro <[email protected]>
  • Loading branch information
MarkNerdi and jeeanribeiro authored Jul 3, 2024
1 parent ca31adb commit 1729a6f
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 109 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/reusable_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,10 @@ jobs:

# Used to read the `binding.gyp` file from `@iota/sdk`
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal

- name: Install LLVM and Clang (Windows) # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
uses: KyleMayes/install-llvm-action@v1
if: ${{ inputs.os == 'windows-2022' }}
Expand Down
208 changes: 106 additions & 102 deletions .github/workflows/reusable_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,116 +71,120 @@ jobs:
working-directory: packages/desktop

- name: Create Release
uses: "actions/github-script@v7"
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref }}
RELEASE_NAME: Bloom Desktop ${{ env.RELEASE_NAME }}
BODY_PATH: packages/desktop/CHANGELOG.md
with:
tag_name: ${{ github.ref }}
release_name: Bloom Desktop ${{ env.RELEASE_NAME }}
body_path: packages/desktop/CHANGELOG.md
draft: true
prerelease: true

- name: Upload macOS binary asset
uses: actions/upload-release-asset@v1
github-token: "${{ secrets.GITHUB_TOKEN }}"
result-encoding: string
script: |
const fs = require('fs');
const { TAG, RELEASE_NAME, BODY_PATH } = process.env;
const tag = TAG.replace('refs/tags/', '');
const releaseName = RELEASE_NAME.replace('refs/tags/', '');
const bodyPath = BODY_PATH;
let bodyFileContent = null;
if (bodyPath !== '' && !!bodyPath) {
try {
bodyFileContent = fs.readFileSync(bodyPath, { encoding: 'utf8' });
} catch (error) {
core.setFailed(error.message);
}
}

const createReleaseResponse = await github.rest.repos.createRelease({
tag_name: tag,
name: releaseName,
body: bodyFileContent,
draft: true,
prerelease: true,
owner: context.repo.owner,
repo: context.repo.repo,
target_commitish: context.sha
});

return createReleaseResponse.data.upload_url;

- name: Upload Windows assets
uses: "actions/github-script@v7"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
UPLOAD_URL: ${{ steps.create_release.outputs.result }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: assets/bloom-desktop-${{ env.VERSION }}.dmg
asset_name: bloom-desktop-${{ env.VERSION }}.dmg
asset_content_type: application/octet-stream

- name: Upload macOS blockmap
uses: actions/upload-release-asset@v1
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
const fs = require('fs').promises;
const { VERSION, UPLOAD_URL } = process.env;
const files = [
`bloom-desktop-${VERSION}.exe`,
`bloom-desktop-${VERSION}.exe.blockmap`,
'latest.yml'
]
for (const file of files) {
await github.rest.repos.uploadReleaseAsset({
url: UPLOAD_URL,
name: file,
data: await fs.readFile('assets/' + file)
});
}

- name: Upload Mac assets
uses: "actions/github-script@v7"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
UPLOAD_URL: ${{ steps.create_release.outputs.result }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: assets/bloom-desktop-${{ env.VERSION }}.dmg.blockmap
asset_name: bloom-desktop-${{ env.VERSION }}.dmg.blockmap
asset_content_type: application/octet-stream

- name: Upload Windows binary asset
uses: actions/upload-release-asset@v1
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
const fs = require('fs').promises;
const { VERSION, UPLOAD_URL } = process.env;
const files = [
`bloom-desktop-${VERSION}.dmg`,
`bloom-desktop-${VERSION}.dmg.blockmap`,
`bloom-desktop-${VERSION}.zip`,
'latest-mac.yml'
]
for (const file of files) {
await github.rest.repos.uploadReleaseAsset({
url: UPLOAD_URL,
name: file,
data: await fs.readFile('assets/' + file)
});
}

- name: Upload Linux assets
uses: "actions/github-script@v7"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
UPLOAD_URL: ${{ steps.create_release.outputs.result }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: assets/bloom-desktop-${{ env.VERSION }}.exe
asset_name: bloom-desktop-${{ env.VERSION }}.exe
asset_content_type: application/octet-stream

- name: Upload Windows blockmap
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: assets/bloom-desktop-${{ env.VERSION }}.exe.blockmap
asset_name: bloom-desktop-${{ env.VERSION }}.exe.blockmap
asset_content_type: application/octet-stream

- name: Upload Linux binary asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: assets/bloom-desktop-${{ env.VERSION }}.AppImage
asset_name: bloom-desktop-${{ env.VERSION }}.AppImage
asset_content_type: application/octet-stream

- name: Upload zip asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: assets/bloom-desktop-${{ env.VERSION }}.zip
asset_name: bloom-desktop-${{ env.VERSION }}.zip
asset_content_type: application/octet-stream

- name: Upload Linux updater yml
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: assets/latest-linux.yml
asset_name: latest-linux.yml
asset_content_type: application/octet-stream

- name: Upload Windows updater yml
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: assets/latest.yml
asset_name: latest.yml
asset_content_type: application/octet-stream

- name: Upload MacOs updater yml
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: assets/latest-mac.yml
asset_name: latest-mac.yml
asset_content_type: application/octet-stream

- name: Upload Linux code signature asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: assets/bloom-desktop-${{ env.VERSION }}.AppImage.asc
asset_name: bloom-desktop-${{ env.VERSION }}.AppImage.asc
asset_content_type: application/pgp-signature

github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
const fs = require('fs').promises;
const { VERSION, UPLOAD_URL } = process.env;
const files = [
`bloom-desktop-${VERSION}.AppImage`,
`bloom-desktop-${VERSION}.AppImage.asc`,
'latest-linux.yml'
]
for (const file of files) {
await github.rest.repos.uploadReleaseAsset({
url: UPLOAD_URL,
name: file,
data: await fs.readFile('assets/' + file)
});
}

- name: Listing artifacts
run: ls -al

0 comments on commit 1729a6f

Please sign in to comment.