Beta #1
This file contains hidden or 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: Beta Release | |
on: | |
push: | |
branches: | |
- beta | |
pull_request: | |
branches: | |
- beta | |
merge_group: | |
types: | |
- checks_requested | |
env: | |
NODE_OPTIONS: --experimental-vm-modules | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Lint files | |
run: yarn lint | |
- name: Typecheck files | |
run: yarn typecheck | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Run unit tests | |
run: yarn test:cov | |
- name: Update Coverage Badge | |
# GitHub actions: default branch variable | |
# https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable | |
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
uses: we-cli/coverage-badge-action@main | |
build-library: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Install missing dependencies | |
run: yarn add -D @ark/schema || echo "Package already installed or not needed" | |
- name: Build package | |
run: yarn prepare | |
build-web: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Prepare library | |
run: yarn prepare | |
- name: Build example for Web | |
run: | | |
yarn example expo export --platform web | |
publish-beta: | |
needs: [lint, test, build-library, build-web] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # To publish a GitHub release | |
issues: write # To comment on released issues | |
pull-requests: write # To comment on released pull requests | |
id-token: write # To enable use of OIDC for npm provenance | |
if: github.ref == 'refs/heads/beta' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Ensures all tags are fetched | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" # Use the latest LTS version of Node.js | |
registry-url: 'https://registry.npmjs.org/' # Specify npm registry | |
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies | |
run: npm audit signatures # Check the signatures to verify integrity | |
- name: Release Beta | |
run: npx semantic-release # Run semantic-release to manage versioning and publishing | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for authentication | |
# Why NODE_AUTH_TOKEN instead of NPM_TOKEN: https://github.com/semantic-release/semantic-release/issues/2313 | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # npm token for publishing package | |