mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Merge pull request #388 from AikidoSec/fix-releases
Fix releases to create draft
This commit is contained in:
commit
72f3ad48cd
1 changed files with 14 additions and 19 deletions
33
.github/workflows/build-and-release.yml
vendored
33
.github/workflows/build-and-release.yml
vendored
|
|
@ -4,6 +4,8 @@ on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "*"
|
- "*"
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
@ -12,30 +14,19 @@ permissions:
|
||||||
jobs:
|
jobs:
|
||||||
set-version:
|
set-version:
|
||||||
name: Set version number
|
name: Set version number
|
||||||
|
if: github.event_name == 'push'
|
||||||
runs-on: open-source-releaser
|
runs-on: open-source-releaser
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.get_version.outputs.tag }}
|
version: ${{ steps.get_version.outputs.tag }}
|
||||||
is_prerelease: ${{ steps.check_prerelease.outputs.is_prerelease }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set version number
|
- name: Set version number
|
||||||
id: get_version
|
id: get_version
|
||||||
run: |
|
run: |
|
||||||
version="${{ github.ref_name }}"
|
version="${{ github.ref_name }}"
|
||||||
echo "tag=$version" >> $GITHUB_OUTPUT
|
echo "tag=$version" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Check if pre-release
|
|
||||||
id: check_prerelease
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
IS_PRERELEASE=$(gh release view ${{ steps.get_version.outputs.tag }} --json isPrerelease --jq '.isPrerelease')
|
|
||||||
echo "is_prerelease=$IS_PRERELEASE" >> $GITHUB_OUTPUT
|
|
||||||
echo "Release ${{ steps.get_version.outputs.tag }} is pre-release: $IS_PRERELEASE"
|
|
||||||
|
|
||||||
create-binaries:
|
create-binaries:
|
||||||
|
if: github.event_name == 'push'
|
||||||
needs: set-version
|
needs: set-version
|
||||||
uses: ./.github/workflows/create-artifact.yml
|
uses: ./.github/workflows/create-artifact.yml
|
||||||
with:
|
with:
|
||||||
|
|
@ -43,6 +34,7 @@ jobs:
|
||||||
|
|
||||||
publish-binaries:
|
publish-binaries:
|
||||||
name: Publish to GitHub release
|
name: Publish to GitHub release
|
||||||
|
if: github.event_name == 'push'
|
||||||
needs: [set-version, create-binaries]
|
needs: [set-version, create-binaries]
|
||||||
runs-on: open-source-releaser
|
runs-on: open-source-releaser
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -81,11 +73,15 @@ jobs:
|
||||||
cp install-scripts/uninstall-endpoint-mac.sh release-artifacts/uninstall-endpoint-mac.sh
|
cp install-scripts/uninstall-endpoint-mac.sh release-artifacts/uninstall-endpoint-mac.sh
|
||||||
cp install-scripts/uninstall-endpoint-windows.ps1 release-artifacts/uninstall-endpoint-windows.ps1
|
cp install-scripts/uninstall-endpoint-windows.ps1 release-artifacts/uninstall-endpoint-windows.ps1
|
||||||
|
|
||||||
- name: Upload binaries to existing GitHub Release
|
- name: Create draft release and upload assets
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
VERSION: ${{ needs.set-version.outputs.version }}
|
||||||
run: |
|
run: |
|
||||||
gh release upload ${{ needs.set-version.outputs.version }} \
|
if ! gh release view "$VERSION" &>/dev/null; then
|
||||||
|
gh release create "$VERSION" --draft --title "$VERSION" --generate-notes
|
||||||
|
fi
|
||||||
|
gh release upload "$VERSION" --clobber \
|
||||||
release-artifacts/safe-chain-macos-x64 \
|
release-artifacts/safe-chain-macos-x64 \
|
||||||
release-artifacts/safe-chain-macos-arm64 \
|
release-artifacts/safe-chain-macos-arm64 \
|
||||||
release-artifacts/safe-chain-linux-x64 \
|
release-artifacts/safe-chain-linux-x64 \
|
||||||
|
|
@ -105,8 +101,7 @@ jobs:
|
||||||
|
|
||||||
publish-npm:
|
publish-npm:
|
||||||
name: Publish to npm
|
name: Publish to npm
|
||||||
needs: [set-version, create-binaries]
|
if: github.event_name == 'release'
|
||||||
if: needs.set-version.outputs.is_prerelease != 'true'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -125,7 +120,7 @@ jobs:
|
||||||
run: curl -fsSL https://github.com/AikidoSec/safe-chain/releases/latest/download/install-safe-chain.sh | sh -s -- --ci
|
run: curl -fsSL https://github.com/AikidoSec/safe-chain/releases/latest/download/install-safe-chain.sh | sh -s -- --ci
|
||||||
|
|
||||||
- name: Set the version in safe-chain package
|
- name: Set the version in safe-chain package
|
||||||
run: npm --no-git-tag-version version ${{ needs.set-version.outputs.version }} --workspace=packages/safe-chain
|
run: npm --no-git-tag-version version ${{ github.event.release.tag_name }} --workspace=packages/safe-chain
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
@ -141,5 +136,5 @@ jobs:
|
||||||
|
|
||||||
- name: Publish to npm
|
- name: Publish to npm
|
||||||
run: |
|
run: |
|
||||||
echo "Publishing version ${{ needs.set-version.outputs.version }} to NPM"
|
echo "Publishing version ${{ github.event.release.tag_name }} to NPM"
|
||||||
npm publish --workspace=packages/safe-chain --access public --provenance
|
npm publish --workspace=packages/safe-chain --access public --provenance
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue