Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding common release pipeline #69

Merged
merged 15 commits into from
Apr 2, 2024
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
67 changes: 67 additions & 0 deletions .github/workflows/release.package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Package release to NPM
on:
workflow_call:
inputs:
working_directory:
required: true
type: string
package_name:
required: true
type: string
secrets:
npm_token:
required: true

Comment on lines +1 to +14
Copy link
Collaborator Author

@CarlosGamero CarlosGamero Mar 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works, I will update api-common release and add the pipeline for all the other packages

jobs:
release:
# Only run for pull requests that has been merged (not closed) and that doesn't have `skip-release` label
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'skip-release') == false
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
scope: '@lokalise'
always-auth: true
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: npm install
working-directory: ${{ inputs.working_directory }}

- name: Build Package
run: npm run build
working-directory: ${{ inputs.working_directory }}

- name: Setup git config
run: |
git config --global user.email "[email protected]"
git config --global user.name "AUTO RELEASE"

# Apply proper semver according to GitHub labels
- name: Major label detected
if: contains(github.event.pull_request.labels.*.name, 'major')
run: npm version major
working-directory: ${{ inputs.working_directory }}
- name: Minor label detected
if: contains(github.event.pull_request.labels.*.name, 'minor')
run: npm version minor
working-directory: ${{ inputs.working_directory }}
- name: Patch label detected
if: contains(github.event.pull_request.labels.*.name, 'patch')
run: npm version patch
working-directory: ${{ inputs.working_directory }}

- name: Git push
run: COMMIT_MSG=$(npm run --silent package-version --workspace=${{ inputs.working_directory }}) && git commit -am "${{ inputs.package_name }} $COMMIT_MSG" && git push origin main

- name: Release Package
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
run: npm publish
working-directory: ${{ inputs.working_directory }}
18 changes: 18 additions & 0 deletions .github/workflows/release.websockets-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Package release to NPM -> websockets-common
on:
pull_request:
types:
- closed
branches:
- main
paths:
- 'packages/app/websockets-common/**'

jobs:
call-build-flow:
uses: lokalise/shared-ts-libs/.github/workflows/release.package.yml@main
with:
working_directory: 'packages/app/websockets-common'
package_name: 'websockets-common'
secrets:
npm_token: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion packages/app/websockets-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"prettier": "^3.2.5",
"rimraf": "^5.0.1",
"typescript": "~5.4.3",
"vite": "^5.0.11",
"vite": "^5.0.13",
"vitest": "1.4.0"
},
"dependencies": {
Expand Down
Loading