chore(deps): lock file maintenance (#4686) #2398
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: | |
- develop | |
paths-ignore: | |
- "sites/static-image-api/**" | |
env: | |
CI: true | |
PNPM_CACHE_FOLDER: .pnpm-store | |
permissions: {} | |
jobs: | |
release: | |
# prevents this action from running on forks | |
if: github.repository == 'undp-data/geohub' | |
permissions: | |
contents: write # to create release (changesets/action) | |
pull-requests: write # to create pull request (changesets/action) | |
name: Changesets Release | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [22] | |
steps: | |
- name: checkout code repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/[email protected] | |
- name: Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: pnpm | |
- name: install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: build packages | |
run: | | |
pnpm build | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
# This expects you to have a script called release which does a build for your packages and calls changeset publish | |
publish: pnpm changeset:release | |
version: pnpm changeset:version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# see https://github.com/peter-evans/create-pull-request/blob/main/docs/examples.md#keep-a-branch-up-to-date-with-another | |
production_release: | |
# prevents this action from running on forks | |
if: github.repository == 'undp-data/geohub' | |
permissions: | |
contents: write # to create release | |
pull-requests: write # to create pull request | |
name: Production Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Reset production branch | |
run: | | |
git fetch origin develop:develop | |
git reset --hard develop | |
- name: Check existance of changeset file | |
id: check-changeset | |
run: | | |
if find .changeset -type f -name '*.md' ! -name 'README.md' | grep -q .; then | |
echo "::set-output name=comment::Changeset files found. This PR cannot be merged. Please merge Version Package PR before merging this." | |
else | |
echo "::set-output name=comment::No changeset files found. It is ready to merge to production." | |
fi | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
branch: release/develop-to-main | |
title: "[RELEASE] Merge develop to main" | |
delete-branch: true | |
commit-message: "[RELEASE] merge develop to main branch" | |
body: | | |
## Description | |
This is going to merge develop branch to main branch to release to production server. | |
You don't have to merge this PR now. You can merge this when it will be ready to merge for production. | |
## Checked result | |
${{ steps.check-changeset.outputs.comment }} | |
### Checklist before merging | |
- [ ] Have you merged `Version Packages` pull request by Changesets? | |
- [ ] Have you add or modify environmental variables in Azure AppService if you have changed anything? | |
- [ ] Are you sure everything works in `dev.undpgeohub.org`? | |
- [ ] Finally, DON'T USE `squash and merge` and just use normal merge for this PR, so there will be the same commit history between `main` and `develop`. | |
--- | |
- Auto-generated by [create-pull-request][1] | |
[1]: https://github.com/peter-evans/create-pull-request | |
labels: release | |
reviewers: | | |
iferencik | |
Thuhaa | |
JinIgarashi | |
- name: Throw error if changeset file exists at the end | |
run: | | |
if echo "${{ steps.check-changeset.outputs.comment }}" | grep -q "Changeset files found."; then | |
echo "${{ steps.check-changeset.outputs.comment }}" | |
exit 1 | |
fi |