Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 0 additions & 84 deletions .github/workflows/publish-dev.yml

This file was deleted.

73 changes: 69 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: Publish packages to NPM

on:
workflow_dispatch:
pull_request:
types:
- closed
branches:
- master
- dev
workflow_run:
workflows: [Update API client]
workflows:
- Update API client
- Update API client (dev)
types:
- completed

Expand All @@ -19,8 +21,8 @@ permissions:
jobs:
publish:
if:
github.event.pull_request.merged == true ||
github.event.workflow_run.conclusion == 'success'
(github.event.workflow_run.name == 'Update API client' || github.event.pull_request.base.ref == 'master') &&
(github.event.pull_request.merged == true || github.event.workflow_run.conclusion == 'success')
runs-on: ubuntu-latest

env:
Expand Down Expand Up @@ -82,3 +84,66 @@ jobs:
--message "chore(release): bump version to %v" \
--yes --no-private \
--tag-version-prefix ""


publish-dev:
if:
github.event.workflow_run.name == 'Update API client (dev)' && github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest

env:
PUBLISH_PAT: ${{ secrets.PUBLISH_PAT }}
GH_TOKEN: ${{ secrets.PUBLISH_PAT }}

steps:
- name: Checkout ⬇️
uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.PUBLISH_PAT }}
ref: ${{ github.event.workflow_run.head_branch }}

- name: Setup Node 🎛️
uses: actions/setup-node@v6
with:
node-version: 24
cache: "yarn"
registry-url: "https://registry.npmjs.org"

- name: Git Identity 🪪
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"

- name: Yarn Install 📦️
run: yarn install --immutable

- name: Setup NX 1/2 🎛️
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: dev

# This step is needed for nx affected to work when CI is running on a PR
# See also https://nx.dev/ci/recipes/set-up/monorepo-ci-github-actions#configuring-ci-using-github-actions-and-nx
- name: Setup NX 2/2 🎛
if:
(github.ref != 'refs/heads/dev' &&
github.event.workflow_run.head_branch != 'dev')
run: git branch --track dev origin/dev

- name: Build 🔨
run: yarn nx affected -t build --parallel=3

# TODO: Uses the previous version. Needs a fix!
- name: Create version file 🔢
run: |
yarn nx run @mittwald/api-client:build:write-version-file
git add .

- name: Version and publish 🚀
run: |
yarn lerna publish 0.0.0-development-$(git rev-parse --short=7 HEAD)-$(date +%Y%m%d) \
--message "chore(release): bump version to %v" \
--yes --no-private \
--tag-version-prefix "" \
--dist-tag development