Skip to content

Merge pull request #142 from rocketclimb/hotfix/hover-issues #134

Merge pull request #142 from rocketclimb/hotfix/hover-issues

Merge pull request #142 from rocketclimb/hotfix/hover-issues #134

Workflow file for this run

name: Release Packages
on:
push:
branches:
- main
permissions: write-all
env:
NODE_VERSION: "18.x"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NEXT_PUBLIC_APP_URL: ${{ vars.NEXT_PUBLIC_APP_URL }}
PRE_RELEASE_TAG: ${{ vars.PRE_RELEASE_TAG }}
AUTOMATION_USER_NAME: ${{ vars.AUTOMATION_USER_NAME }}
AUTOMATION_USER_EMAIL: ${{ vars.AUTOMATION_USER_EMAIL }}
jobs:
create-tag:
name: Create Tag
runs-on: ubuntu-latest
outputs:
latest-workflow-run-id: ${{ steps.get-latest-workflow-run.outputs.LATEST_WORKFLOW_RUN_ID }}
pending-tag: ${{ steps.set-tag.outputs.PENDING_TAG }}
is-release: ${{ contains(steps.set-tag.outputs.PENDING_TAG, 'release') }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Getting Latest Workflow Run ID
id: get-latest-workflow-run
run: |
echo "LATEST_WORKFLOW_RUN_ID=$(curl -L -H 'Accept: application/vnd.github+json' -H 'Authorization: Bearer ${{ env.GH_TOKEN }}' -H 'X-GitHub-Api-Version: 2022-11-28' '${{ github.api_url }}/repos/${{ github.repository }}/actions/workflows/prepare-release.yml/runs?status=success&per_page=1' | jq '.workflow_runs[0].id')" >> $GITHUB_OUTPUT
- name: Download tag artifact
id: download-tag-artifact
uses: actions/download-artifact@v4
with:
name: tag-artifact
github-token: ${{ env.GH_TOKEN }}
run-id: ${{ steps.get-latest-workflow-run.outputs.LATEST_WORKFLOW_RUN_ID }}
- name: Set tag as environment variable
id: set-tag
run: |
echo "PENDING_TAG=$(cat .tagrc)" >> $GITHUB_OUTPUT
- name: Setup git user
run: |
git config user.name ${{ env.AUTOMATION_USER_NAME }}
git config user.email ${{ env.AUTOMATION_USER_EMAIL }}
- name: Creating Tag ${{ steps.set-tag.outputs.PENDING_TAG }}
run: |
git tag --force -a ${{ steps.set-tag.outputs.PENDING_TAG }} -m "${{ steps.set-tag.outputs.PENDING_TAG }}" && git push origin ${{ steps.set-tag.outputs.PENDING_TAG }} --no-verify
create-release:
name: Create rocketicons release
runs-on: ubuntu-latest
needs: create-tag
if: needs.create-tag.outputs.is-release == 'true'
outputs:
package-name: ${{ steps.get-package-name.outputs.PKG_NAME }}
steps:
- run: echo "Generating the Release for '${{ needs.create-tag.outputs.pending-tag }}'"
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"
always-auth: true
- name: Download deployable artifacts
uses: actions/download-artifact@v4
with:
name: deployable-artifacts
github-token: ${{ env.GH_TOKEN }}
run-id: ${{ needs.create-tag.outputs.latest-workflow-run-id }}
- name: Publish package
run: |
tar zxf *.tgz && (cd package && npm publish) && rm -fR package
- name: Get package name
id: get-package-name
run: |
echo "PKG_NAME=$(ls *.tgz)" >> $GITHUB_OUTPUT
- name: Release ${{ needs.create-tag.outputs.pending-tag }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.create-tag.outputs.pending-tag }}
body_path: ${{ github.workspace }}/release-notes.md
token: ${{ env.GH_TOKEN }}
files: |
${{ steps.get-package-name.outputs.PKG_NAME }}
get-dependency-token:
name: Get Dependency Token
runs-on: ubuntu-latest
outputs:
dependency-hash: ${{ steps.get-dependency-hash.outputs.DEPENDENCY_HASH }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get Dependency Hash
id: get-dependency-hash
run: echo "DEPENDENCY_HASH=$(npx --yes @rocketclimb/sh extract-dependencies)" >> $GITHUB_OUTPUT
publish-ignition:
name: Publish Ignition without rocketicons release
if: needs.create-tag.outputs.is-release == 'false'
needs:
- create-tag
- get-dependency-token
uses: ./.github/workflows/publish-ignition.yml
secrets:
token: ${{ secrets.VERCEL_TOKEN }}
with:
dependencies-hash: ${{ needs.get-dependency-token.outputs.dependency-hash }}
run-id: ${{ needs.create-tag.outputs.latest-workflow-run-id }}
env: "production"
branch: "main"
publish-ignition-for-release:
name: Publish Ignition with rocketicons release
if: needs.create-tag.outputs.is-release == 'true'
needs:
- create-tag
- create-release
- get-dependency-token
uses: ./.github/workflows/publish-ignition.yml
secrets:
token: ${{ secrets.VERCEL_TOKEN }}
with:
dependencies-hash: ${{ needs.get-dependency-token.outputs.dependency-hash }}
run-id: ${{ needs.create-tag.outputs.latest-workflow-run-id }}
env: "production"
branch: "main"