2022-03-09 15:06:53 +00:00
name : Release Build
on :
2023-08-10 09:34:50 +00:00
push :
2022-03-09 15:06:53 +00:00
branches :
- 'release/**'
concurrency :
group : ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress : true
jobs :
2024-06-05 05:24:25 +00:00
# shared kong github action for security checking
generate-sbom-and-upload-assets :
2024-06-04 13:43:28 +00:00
runs-on : ubuntu-latest
permissions :
2024-06-05 05:24:25 +00:00
packages : write
2024-06-04 13:43:28 +00:00
contents : write # publish sbom to GH releases/tag assets
steps :
- name : Checkout repository
uses : actions/checkout@v3
2024-06-05 05:24:25 +00:00
# Perform SCA / SBOM analysis for the entire monorepo code repository
# Produces SCA(SBOM and CVE) report
2024-06-04 13:43:28 +00:00
# Helps understand vulnerabilities / license compliance across third party dependencies
# Automatically uploads to workflow assets
2024-06-05 05:24:25 +00:00
# (TODO): Produce workspace/package specific SBOM. Current limitation: https://github.com/anchore/syft/issues/2574
# (TODO): needs check (block) further steps if SCA fails
2024-06-04 13:43:28 +00:00
- id : sca-project
uses : Kong/public-shared-actions/security-actions/sca@62643b74f79f6a697b9add1a2f9c069bf9ca1250 # v2.3.0
with :
dir : .
upload-sbom-release-assets : false
2022-03-09 15:06:53 +00:00
build-and-upload-release-artifacts :
2024-02-05 15:15:58 +00:00
timeout-minutes : 30
2022-03-09 15:06:53 +00:00
runs-on : ${{ matrix.os }}
2024-06-04 13:43:28 +00:00
env :
INSO_PACKAGE_NAME : insomnia-inso
INSO_DOCKER_TAR : inso-docker-image.tar
2022-03-09 15:06:53 +00:00
strategy :
fail-fast : false
matrix :
include :
2024-06-05 05:24:25 +00:00
# macos-13 supports both intel and apple silicon on inso cli properly
# macos-latest is defaulting to apple silicon and breaks inso cli retrocompatibility
2024-06-04 13:31:59 +00:00
- os : macos-13
2023-06-27 18:16:03 +00:00
csc_link_secret : DESIGNER_MAC_CSC_LINK
csc_key_password_secret : DESIGNER_MAC_CSC_KEY_PASSWORD
2022-03-09 15:06:53 +00:00
- os : windows-latest
2022-11-17 15:06:26 +00:00
csc_link_secret : DESIGNER_WINDOWS_CSC_LINK
csc_key_password_secret : DESIGNER_WINDOWS_CSC_KEY_PASSWORD
2022-03-09 15:06:53 +00:00
- os : ubuntu-latest
csc_link_secret : ''
csc_key_password_secret : ''
steps :
- name : Checkout branch
2024-02-27 14:49:14 +00:00
uses : actions/checkout@v4
2022-03-09 15:06:53 +00:00
- name : Setup Node
2024-02-27 14:49:14 +00:00
uses : actions/setup-node@v4
2022-03-09 15:06:53 +00:00
with :
node-version-file : '.nvmrc'
2023-08-09 22:14:16 +00:00
cache : 'npm'
cache-dependency-path : package-lock.json
2022-03-09 15:06:53 +00:00
2023-08-09 22:14:16 +00:00
- name : Install packages
run : npm ci
2022-03-09 15:06:53 +00:00
2024-06-26 10:36:08 +00:00
# If this step fails its possible apple has new license terms which need to be accepted by logging into https://developer.apple.com/account
2023-06-27 18:16:03 +00:00
- name : Package app (MacOS only)
2024-06-04 13:31:59 +00:00
if : matrix.os == 'macos-13'
2023-06-27 18:16:03 +00:00
shell : bash
run : npm run app-package
env :
NODE_OPTIONS : '--max_old_space_size=6144'
2024-06-04 13:31:59 +00:00
APPLE_ID : ${{ matrix.os == 'macos-13' && secrets.DESIGNER_APPLE_ID || '' }}
APPLE_APP_SPECIFIC_PASSWORD : ${{ matrix.os == 'macos-13' && secrets.DESIGNER_APPLE_ID_PASSWORD || '' }}
2023-06-27 18:16:03 +00:00
CSC_LINK : ${{ matrix.csc_link_secret != '' && secrets[matrix.csc_link_secret] || '' }}
CSC_KEY_PASSWORD : ${{ matrix.csc_key_password_secret != '' && secrets[matrix.csc_key_password_secret] || '' }}
2022-11-17 15:06:26 +00:00
2022-12-12 13:13:35 +00:00
- name : Package app (Windows and Linux)
2024-06-04 13:31:59 +00:00
if : matrix.os != 'macos-13'
2022-12-12 13:13:35 +00:00
shell : bash
run : npm run app-package
env :
NODE_OPTIONS : '--max_old_space_size=6144'
2022-03-09 15:06:53 +00:00
- name : Setup Inso CLI version env var
run :
2024-06-04 13:43:28 +00:00
echo "INSO_VERSION=$(jq .version ./packages/${{ env.INSO_PACKAGE_NAME }}/package.json -rj)" >> $GITHUB_ENV
2022-03-09 15:06:53 +00:00
- name : Package inso
2023-08-10 09:04:28 +00:00
run : |
echo "Replacing electron binary with node binary"
node_modules/.bin/node-pre-gyp install --update-binary --directory node_modules/@getinsomnia/node-libcurl
npm run inso-package
2022-03-09 15:06:53 +00:00
env :
VERSION : ${{ env.INSO_VERSION }}
2023-06-27 18:16:03 +00:00
- name : Code-sign & create Inso CLI installer (macOS only)
2024-06-04 13:31:59 +00:00
if : matrix.os == 'macos-13'
2023-06-27 18:16:03 +00:00
run : ./src/scripts/macos-pkg.sh
shell : bash
2024-06-04 13:43:28 +00:00
working-directory : ./packages/${{ env.INSO_PACKAGE_NAME }}
2023-06-27 18:16:03 +00:00
continue-on-error : false
env :
MACOS_CERTIFICATE : ${{ secrets.DESIGNER_MAC_CSC_LINK }}
MACOS_CERTIFICATE_PWD : ${{ secrets.DESIGNER_MAC_CSC_KEY_PASSWORD }}
PKG_NAME : inso-${{ matrix.os }}-${{ env.INSO_VERSION }}
BUNDLE_ID : com.insomnia.inso
VERSION : ${{ env.INSO_VERSION }}
2022-03-09 15:06:53 +00:00
2023-06-27 18:16:03 +00:00
- name : Notarize Inso CLI installer (macOS only)
2024-06-04 13:31:59 +00:00
if : matrix.os == 'macos-13'
2023-08-22 17:05:17 +00:00
uses : lando/notarize-action@v2
2023-06-27 18:16:03 +00:00
with :
2024-06-04 13:43:28 +00:00
product-path : ./packages/${{ env.INSO_PACKAGE_NAME }}/artifacts/inso-${{ matrix.os }}-${{ env.INSO_VERSION }}.pkg
2023-06-27 18:16:03 +00:00
primary-bundle-id : com.insomnia.inso
appstore-connect-username : ${{ secrets.DESIGNER_APPLE_ID }}
appstore-connect-password : ${{ secrets.DESIGNER_APPLE_ID_PASSWORD }}
2023-08-22 18:11:12 +00:00
appstore-connect-team-id : FX44YY62GV
2024-06-06 20:49:02 +00:00
verbose : true
2022-03-09 15:06:53 +00:00
2023-06-27 18:16:03 +00:00
- name : Staple Inso CLI installer (macOS only)
2024-06-04 13:31:59 +00:00
if : matrix.os == 'macos-13'
2023-08-22 17:05:17 +00:00
uses : BoundfoxStudios/action-xcode-staple@v1
2023-06-27 18:16:03 +00:00
with :
2024-06-04 13:43:28 +00:00
product-path : ./packages/${{ env.INSO_PACKAGE_NAME }}/artifacts/inso-${{ matrix.os }}-${{ env.INSO_VERSION }}.pkg
2022-03-09 15:06:53 +00:00
2023-06-27 18:16:03 +00:00
- name : Notarize Inso CLI binary (macOS only)
2024-06-04 13:31:59 +00:00
if : matrix.os == 'macos-13'
2023-08-22 17:05:17 +00:00
uses : lando/notarize-action@v2
2023-06-27 18:16:03 +00:00
with :
2024-06-04 13:43:28 +00:00
product-path : ./packages/${{ env.INSO_PACKAGE_NAME }}/binaries/inso
2023-06-27 18:16:03 +00:00
primary-bundle-id : com.insomnia.inso-binary
appstore-connect-username : ${{ secrets.DESIGNER_APPLE_ID }}
appstore-connect-password : ${{ secrets.DESIGNER_APPLE_ID_PASSWORD }}
2023-08-22 18:11:12 +00:00
appstore-connect-team-id : FX44YY62GV
2022-03-09 15:06:53 +00:00
2024-07-30 11:29:45 +00:00
- name : Create Inso zip/tar/gz artifacts
run : npm run artifacts -w insomnia-inso
2022-03-09 15:06:53 +00:00
2024-06-04 13:43:28 +00:00
- name : Create inso Docker Image artifacts
2022-05-09 11:37:33 +00:00
if : matrix.os == 'ubuntu-latest'
run : |
2024-06-04 13:43:28 +00:00
DOCKER_BUILDKIT=1 docker build --tag ${{ env.INSO_PACKAGE_NAME }}:temp ./packages/${{ env.INSO_PACKAGE_NAME }}
docker save ${{ env.INSO_PACKAGE_NAME }}:temp -o ./packages/${{ env.INSO_PACKAGE_NAME }}/artifacts/${{ env.INSO_DOCKER_TAR }}
2024-06-05 05:24:25 +00:00
2024-06-04 13:43:28 +00:00
# Produce Docker SBOM for Inso Image
# Automatically uploads to workflow assets
- name : Scan inso docker artifacts
id : sbom_action
if : matrix.os == 'ubuntu-latest'
uses : Kong/public-shared-actions/security-actions/scan-docker-image@62643b74f79f6a697b9add1a2f9c069bf9ca1250 # v2.3.0
with :
asset_prefix : image-inso-${{ runner.os }}
image : ./packages/${{ env.INSO_PACKAGE_NAME }}/artifacts/${{ env.INSO_DOCKER_TAR }}
upload-sbom-release-assets : false # No release is publushed yet. Uploads as workflow assets
env :
SYFT_SOURCE_NAME : ${{ env.INSO_DOCKER_TAR }}
2022-05-09 11:37:33 +00:00
2022-03-09 15:06:53 +00:00
- name : Upload artifacts
2024-02-27 14:49:14 +00:00
uses : actions/upload-artifact@v4
2022-03-09 15:06:53 +00:00
with :
if-no-files-found : ignore
name : ${{ matrix.os }}-artifacts
path : |
2022-04-20 17:42:19 +00:00
packages/insomnia/dist/*.exe
packages/insomnia/dist/squirrel-windows/*
packages/insomnia/dist/*.zip
packages/insomnia/dist/*.dmg
packages/insomnia/dist/*.snap
packages/insomnia/dist/*.rpm
packages/insomnia/dist/*.deb
packages/insomnia/dist/*.AppImage
packages/insomnia/dist/*.tar.gz
2022-03-09 15:06:53 +00:00
packages/insomnia-inso/artifacts/*
2022-06-28 09:29:28 +00:00
- name : Upload source assets for Sentry
2024-02-27 14:49:14 +00:00
uses : actions/upload-artifact@v4
2022-06-28 09:29:28 +00:00
with :
name : ${{ matrix.os }}-sentry
path : |
packages/insomnia/build/*.js
packages/insomnia/build/*.map
!packages/insomnia/build/yarn-standalone.js
2022-03-09 15:06:53 +00:00
update-pull-request :
2024-02-05 15:15:58 +00:00
timeout-minutes : ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }}
2022-03-09 15:06:53 +00:00
needs : build-and-upload-release-artifacts
runs-on : ubuntu-latest
steps :
- name : Get release version
id : release_version
shell : bash
run : |
2022-10-17 12:14:47 +00:00
echo "version=${BRANCH/release\//}" >> $GITHUB_OUTPUT
2022-03-09 15:06:53 +00:00
env :
BRANCH : ${{ github.ref_name }}
- name : update-pull-request
2022-10-31 08:54:01 +00:00
uses : kt3k/update-pr-description@v2.0.0
2022-03-09 15:06:53 +00:00
with :
pr_body : |
2024-03-12 15:53:41 +00:00
**WARNING: Do not merge this PR. This is an automated release PR. It should be released using the "Publish" workflow.**
2022-03-09 15:06:53 +00:00
Download release artifacts [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
## Steps for Publish:
2024-04-19 08:50:44 +00:00
You can update the changelog.md in this branch, run git log to get the latest changes :
```bash
git log --no-merges --oneline --pretty=format:'* %s by @%an' --since="<last release tag>" --until="release/${{ steps.release_version.outputs.version }}"
```
2022-03-09 15:06:53 +00:00
When ready to publish, trigger [Publish](https://github.com/${{ github.repository }}/actions/workflows/release-publish.yml) workflow with these variables:
- Release version (`version`) : `${{ steps.release_version.outputs.version }}`
Alternatively, you can trigger the workflow from [Github CLI](https://cli.github.com/) :
```bash
2022-03-09 16:21:01 +00:00
gh workflow run release-publish.yml -f version=${{ steps.release_version.outputs.version }} --repo ${{ github.repository }}
2022-03-09 15:06:53 +00:00
```
2022-03-24 12:20:24 +00:00
2024-04-19 08:50:44 +00:00
Release notes will be generated automatically based on the commit messages during publish. Remove any unwanted notes manually afterwards.
2022-03-24 12:20:24 +00:00
<details>
<summary>Conflicts? Merge branch step failed on the publish workflow? Try this...</summary>
Run locally :
```bash
# Make sure git remote is Kong/insomnia...
git checkout develop
git merge --no-ff release/<replaced with version>
# Solve merge conflicts ...
2023-08-09 22:14:16 +00:00
# If there's package-lock conflicts, run `npm install` and commit the package-lock changes
2022-03-24 12:20:24 +00:00
git push
```
</details>
2022-03-09 15:06:53 +00:00
destination_branch : develop
github_token : ${{ secrets.GITHUB_TOKEN }}