Merge pull request #1141 from near/dev #43
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
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
actions: write | |
issues: write | |
pull-requests: write | |
contents: write | |
jobs: | |
release: | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Git | |
run: | | |
git config user.name "GitHub Bot" | |
git config user.email "[email protected]" | |
- run: echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ./.npmrc | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
cache: 'yarn' | |
- name: Check example apps | |
run: echo "EXAMPLE_APPS=$(ls ./examples | tr '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile --prefer-offline | |
- name: Bump version | |
if: github.ref == 'refs/heads/main' | |
run: yarn nx run core:version --dryRun | |
- name: Bump version | |
if: github.ref != 'refs/heads/main' | |
run: yarn nx run core:version:dev --dryRun | |
- name: Tag version | |
if: github.ref == 'refs/heads/main' | |
run: echo "GIT_TAG=$(git describe --exact-match --tags $(git log -n1 --pretty='%h') 2> /dev/null)" >> $GITHUB_ENV | |
- name: Run Build All | |
run: yarn build:all | |
# Use npx instead of yarn because yarn automatically sets NPM_* environment variables | |
# like NPM_CONFIG_REGISTRY so npm publish ends up ignoring the .npmrc file | |
# which is set up by `setup-node` action. | |
- name: Deploy | |
run: npx nx run-many --target=deploy --all --noBuild --exclude=$EXAMPLE_APPS --dry-run | |
env: | |
EXAMPLE_APPS: ${{ env.EXAMPLE_APPS }} | |
# Drafts your next Release notes as Pull Requests are merged into "main" | |
- name: Draft Release notes | |
id: draft-release-notes | |
uses: release-drafter/release-drafter@v5 | |
if: github.ref == 'refs/heads/main' | |
with: | |
config-name: release-drafter.yml | |
publish: true | |
tag: ${{ env.GIT_TAG }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
force: true | |
tags: true | |