diff --git a/.github/workflows/deploy-snap-beta.yml b/.github/workflows/deploy-snap-beta.yml deleted file mode 100644 index 05d0b33..0000000 --- a/.github/workflows/deploy-snap-beta.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Deploy Snap Beta - -on: - workflow_dispatch: - -jobs: - deploy: - name: Publish Snap to npm - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.ref_name }} - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: 20 - - - name: Install dependencies - run: yarn workspaces focus genlayer-wallet-plugin - - - name: Build Snap - run: yarn workspace genlayer-wallet-plugin build - - - name: Configure Git Identity - run: | - git config --global user.email "github-actions[bot]@genlayer.com" - git config --global user.name "github-actions[bot]" - - - name: Patch version - run: | - yarn workspace genlayer-wallet-plugin version patch - VERSION=$(jq -r ".version" "packages/snap/package.json") - echo "VERSION=$VERSION" >> "$GITHUB_ENV" - - - name: Commit Version Bump - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: 'chore: bump version to ${{ env.VERSION }}' - tagging_message: 'v${{ env.VERSION }}' - push_options: --force - branch: ${{ github.ref_name }} - - - name: Create GitHub Release - uses: softprops/action-gh-release@v1 - with: - tag_name: 'v${{ env.VERSION }}' - name: 'Release v${{ env.VERSION }}' - body: 'Automated release for version v${{ env.VERSION }}' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish to npm - env: - YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - run: yarn workspace genlayer-wallet-plugin npm publish --tag beta --access public diff --git a/.github/workflows/deploy-snap.yml b/.github/workflows/deploy-snap.yml index b8cae7e..b5aaab0 100644 --- a/.github/workflows/deploy-snap.yml +++ b/.github/workflows/deploy-snap.yml @@ -1,7 +1,16 @@ -name: Deploy Snap Production +name: Deploy Snap on: workflow_dispatch: + inputs: + channel: + description: 'Release channel' + required: true + default: 'production' + type: choice + options: + - production + - beta jobs: deploy: @@ -9,18 +18,20 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + id-token: write steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.ref_name }} - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20 + registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: yarn workspaces focus genlayer-wallet-plugin @@ -53,10 +64,15 @@ jobs: tag_name: 'v${{ env.VERSION }}' name: 'Release v${{ env.VERSION }}' body: 'Automated release for version v${{ env.VERSION }}' + prerelease: ${{ inputs.channel == 'beta' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Publish to npm - env: - YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - run: yarn workspace genlayer-wallet-plugin npm publish --access public + working-directory: packages/snap + run: | + if [ "${{ inputs.channel }}" = "beta" ]; then + npm publish --provenance --tag beta --access public + else + npm publish --provenance --access public + fi