Skip to content

Commit

Permalink
ci: split ci and publish workflows (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-bodnar authored Jul 5, 2024
1 parent da2404f commit f712142
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 24 deletions.
25 changes: 1 addition & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,25 @@
name: Main CI

on:
workflow_dispatch:
inputs:
distTag:
description: "Dist tag to publish"
required: true
default: "latest"
pull_request:
push:
branches:
- "main"

jobs:
build_and_testing:
runs-on: ubuntu-latest
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-node@v4
with:
always-auth: true
cache: "yarn"
node-version: 20

- name: Creates local .npmrc
if: ${{github.event.inputs.distTag == 'latest'}}
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- name: Install
run: yarn install --frozen-lockfile

Expand All @@ -46,10 +30,3 @@ jobs:
run: |
yarn build
yarn test
- name: Release
if: ${{github.event.inputs.distTag == 'latest'}}
run: |
git config --global user.email "[email protected]"
git config --global user.name "Lingui CI"
npm run release
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v4
with:
always-auth: true
node-version: 20
cache: "yarn"
scope: "@lingui"

- name: Install & Build
run: |
yarn install --frozen-lockfile
yarn build
- name: Creates local .npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- name: Prepare Lingui-Bot git account
uses: oleksiyrudenko/gha-git-credentials@v2-latest
with:
name: "Lingui Bot"
email: "[email protected]"
actor: "lingui-bot"
token: "${{ secrets.GH_TOKEN }}"

- name: Release
run: npm run release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
.idea

0 comments on commit f712142

Please sign in to comment.