Skip to content

chore: 🤖 updated semantic release for trusted publishing #233

chore: 🤖 updated semantic release for trusted publishing

chore: 🤖 updated semantic release for trusted publishing #233

Workflow file for this run

name: Workflow
on:
push:
branches:
- main
- beta
- alpha
pull_request:
branches:
- main
- beta
- alpha
# concurrency:
# group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
# # Allow cancellation except on release branches (main, beta, alpha) where release job runs
# cancel-in-progress:
# ${{ !(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/alpha') }}
jobs:
prepare-environment:
name: Prepare environment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.19.3"
cache: "yarn"
cache-dependency-path: yarn.lock
env:
FORCE_COLOR: 0
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: |
echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "version=$(yarn -v)" >> $GITHUB_OUTPUT
- name: Install node_modules
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Cache node_modules
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
'**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
tests:
name: Run tests
runs-on: ubuntu-latest
needs: prepare-environment
# Tests timeout after 40 minutes
timeout-minutes: 40
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.19.3"
cache: "yarn"
cache-dependency-path: yarn.lock
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: |
echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "version=$(yarn -v)" >> $GITHUB_OUTPUT
- name: Restore node_modules
uses: actions/cache/restore@v3
id: cache-node-modules
with:
path: |
**/node_modules
**/.eslintcache
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install node_modules on cache miss
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Lint
run: yarn lint
- name: Typecheck
run: yarn typescheck
- name: Test
run: yarn test --coverage
- name: Send Report
uses: qltysh/qlty-action/coverage@v1
with:
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
files: |
${{github.workspace}}/packages/adapter-axios/coverage/lcov.info:lcov
${{github.workspace}}/packages/adapter-graphql/coverage/lcov.info:lcov
${{github.workspace}}/packages/cli/coverage/lcov.info:lcov
${{github.workspace}}/packages/core/coverage/lcov.info:lcov
${{github.workspace}}/packages/plugin-devtools/coverage/lcov.info:lcov
${{github.workspace}}/packages/plugin-eslint/coverage/lcov.info:lcov
${{github.workspace}}/packages/react/coverage/lcov.info:lcov
${{github.workspace}}/packages/sockets/coverage/lcov.info:lcov
# build_on_win:
# name: Build HyperFlow on Windows
# if:
# ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' ||
# github.ref == 'refs/heads/alpha' }}
# runs-on: windows-latest
# needs: tests
# # Tests timeout after 40 minutes
# timeout-minutes: 40
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: "20.19.3"
# cache: "yarn"
# cache-dependency-path: yarn.lock
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: |
# echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
# echo "version=$(yarn -v)" >> $GITHUB_OUTPUT
# - name: Restore node_modules
# uses: actions/cache/restore@v3
# id: cache-node-modules
# with:
# path: |
# **/node_modules
# **/.eslintcache
# ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# - name: Install node_modules on cache miss
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
# run: yarn install --frozen-lockfile --network-timeout 1000000
# - name: Cache node_modules
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
# uses: actions/cache/save@v3
# with:
# path: |
# ${{ steps.yarn-cache-dir-path.outputs.dir }}
# '**/node_modules'
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# - name: Build
# run: yarn build
# - name: App build
# run: yarn nx run hyper-flow:make:app
# env:
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
# APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# SIGN_ID: ${{ secrets.SIGN_ID }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# build_on_linux:
# name: Build HyperFlow on Linux
# if:
# ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' ||
# github.ref == 'refs/heads/alpha' }}
# runs-on: ubuntu-latest
# needs: tests
# # Tests timeout after 40 minutes
# timeout-minutes: 40
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: "20.19.3"
# cache: "yarn"
# cache-dependency-path: yarn.lock
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: |
# echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
# echo "version=$(yarn -v)" >> $GITHUB_OUTPUT
# - name: Restore node_modules
# uses: actions/cache/restore@v3
# id: cache-node-modules
# with:
# path: |
# **/node_modules
# **/.eslintcache
# ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# - name: Install node_modules on cache miss
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
# run: yarn install --frozen-lockfile
# - name: Cache node_modules
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
# uses: actions/cache/save@v3
# with:
# path: |
# ${{ steps.yarn-cache-dir-path.outputs.dir }}
# '**/node_modules'
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# - name: Build
# run: yarn build
# - name: App build
# run: yarn nx run hyper-flow:make:app
# env:
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
# APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# SIGN_ID: ${{ secrets.SIGN_ID }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# build_on_mac:
# name: Build HyperFlow on Mac
# if:
# ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' ||
# github.ref == 'refs/heads/alpha' }}
# runs-on: macos-latest
# # Tests timeout after 40 minutes
# timeout-minutes: 40
# needs: tests
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: "20.19.3"
# cache: "yarn"
# cache-dependency-path: yarn.lock
# - name: Install Python
# uses: actions/setup-python@v4
# with:
# python-version: "3.11"
# - name: Import codesign certs
# uses: apple-actions/import-codesign-certs@v3
# with:
# p12-file-base64: ${{ secrets.APPSTORE_CERTIFICATES_FILE_BASE64 }}
# p12-password: ${{ secrets.APPSTORE_CERTIFICATES_PASSWORD }}
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: |
# echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
# echo "version=$(yarn -v)" >> $GITHUB_OUTPUT
# - name: Restore node_modules
# uses: actions/cache/restore@v3
# id: cache-node-modules
# with:
# path: |
# **/node_modules
# **/.eslintcache
# ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# - name: Install node_modules on cache miss
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
# run: yarn install --frozen-lockfile
# - name: Install macos-alias
# run: yarn add macos-alias@0.2.12 -W
# - name: Rebuild native modules
# run: |
# npm install -g node-gyp
# npm rebuild
# yarn install --frozen-lockfile --force
# - name: Cache node_modules
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
# uses: actions/cache/save@v3
# with:
# path: |
# ${{ steps.yarn-cache-dir-path.outputs.dir }}
# '**/node_modules'
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# - name: Build
# run: yarn build
# - name: App build
# run: yarn nx run hyper-flow:make:app
# env:
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
# APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# SIGN_ID: ${{ secrets.SIGN_ID }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Release
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/alpha' }}
runs-on: ubuntu-latest
needs: [tests]
# needs: [build_on_linux, build_on_mac, build_on_win]
outputs:
released: ${{ steps.check_release.outputs.released }}
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for trusted publishing and npm provenance
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.19.3"
cache: "yarn"
cache-dependency-path: yarn.lock
registry-url: "https://registry.npmjs.org"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: |
echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "version=$(yarn -v)" >> $GITHUB_OUTPUT
- name: Restore node_modules
uses: actions/cache/restore@v3
id: cache-node-modules
with:
path: |
**/node_modules
**/.eslintcache
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install node_modules on cache miss
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Get latest tag before release
id: pre_release_tag
run: echo "tag=$(git describe --tags --abbrev=0 || echo 'none')" >> $GITHUB_OUTPUT
- name: Publish
run: yarn release
env:
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get latest tag after release
id: post_release_tag
run: |
git fetch --tags
echo "tag=$(git describe --tags --abbrev=0 || echo 'none')" >> $GITHUB_OUTPUT
- name: Check if a new tag was created
id: check_release
run: |
if [[ "${{ steps.pre_release_tag.outputs.tag }}" == "${{ steps.post_release_tag.outputs.tag }}" ]]; then
echo "No new tag was created"
echo "released=false" >> $GITHUB_OUTPUT
else
echo "New tag ${{ steps.post_release_tag.outputs.tag }} was created"
echo "released=true" >> $GITHUB_OUTPUT
fi
# hyper-flow-release:
# name: Trigger HyperFlow Release
# needs: release
# if:
# ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/alpha') &&
# needs.release.outputs.released == 'true' }}
# uses: ./.github/workflows/flow-release.yml
# secrets: inherit