Merge pull request #394 from idexio/feat/add-conditional-order-props-… #405
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
- beta | |
- alpha | |
env: | |
CI: true | |
SKIP_HOOK_COMMIT_MSG: 1 | |
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
GIT_AUTHOR_NAME: idex-bot | |
GIT_AUTHOR_EMAIL: monitor@idex.io | |
GIT_COMMITTER_NAME: idex-bot | |
GIT_COMMITTER_EMAIL: monitor@idex.io | |
permissions: write-all | |
jobs: | |
pr: | |
name: Create Release PR | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check For PR | |
env: | |
REF: ${{ env.GITHUB_BASE_REF }} | |
BASE: main | |
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | |
run: | | |
BRANCH=${GITHUB_REF##*/} | |
echo "Branch: $BRANCH" | |
[[ "$BRANCH" == "$BASE" ]] && exit 0; | |
if [[ "$BRANCH" == "alpha" ]]; then | |
BASE="beta" | |
fi | |
echo "Check If PR exists for $GITHUB_REPOSITORY $BRANCH --> $BASE" | |
gh auth status | |
if [[ "$(gh pr list -R "$GITHUB_REPOSITORY" --base "$BASE" --state open --label "Release $BRANCH")" == "" ]]; then | |
echo "Creating PR $BRANCH --> $BASE" | |
RESULT=$(gh api repos/"${GITHUB_REPOSITORY}"/pulls -F head="$BRANCH" -F base="$BASE" -F title="Release $BRANCH" -F body="This PR was generated automatically. Merging it will transition $BRANCH into ${BASE}.") | |
PR_NUM=$(echo $RESULT | jq -r '.number') | |
printf '{"labels": ["Release %s"]}' $BRANCH | gh api repos/"${GITHUB_REPOSITORY}"/issues/"${PR_NUM}"/labels --input - | |
fi | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
node-version-file: ".nvmrc" | |
check-latest: true | |
- name: Enable Corepack | |
run: corepack enable | |
# - name: Get yarn cache directory path | |
# id: yarn-cache-dir-path | |
# run: echo "::set-output name=dir::$(yarn cache dir)" | |
# - uses: actions/cache@v3 | |
# id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
# with: | |
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Build Library | |
run: yarn build | |
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies | |
run: npm audit signatures | |
- name: Build TypeDoc | |
run: yarn typedoc:build | |
- name: Semantic Release | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | |
run: yarn semantic-release |