refactor: enable TS strict mode (#889) #126
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 | |
- next | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
# See provenance docs: https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions | |
id-token: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.RELEASE_GH_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Install dependencies and build TS | |
run: npm ci && npm run build | |
- name: Install semantic-release and friends | |
run: npm i --no-save semantic-release@21 @semantic-release/changelog@6 @semantic-release/exec@6 @semantic-release/git@10 | |
# We do a dry run here to analyze the commits and grab the next version | |
# for usage in the Docker metadata action | |
- name: Dry run of semantic-release workflow | |
run: npx semantic-release --dry-run | |
id: release | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# For every release we add 2-3 tags to the docker build: | |
# 1. A semver tag (e.g., 8.0.0, 8.0.0-next.0) | |
# 2. A branch tag (e.g., next, main) | |
# 3. A `latest` tag (only on the main branch) | |
tags: | | |
type=semver,pattern={{version}},value=${{ steps.release.outputs.nextVersion }} | |
type=ref,event=branch | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
- name: Run semantic-release workflow | |
env: | |
GH_TOKEN: ${{ secrets.RELEASE_GH_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# See provenance docs: https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions | |
NPM_CONFIG_PROVENANCE: 'true' | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npx semantic-release | |
- name: Sync changes back to next | |
if: ${{ github.ref }} == 'refs/heads/main' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.RELEASE_GH_TOKEN }} | |
branch: next |