Release/1.0.4 #2
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: Publish | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: | ||
- closed | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
packages: write | ||
jobs: | ||
publish: | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: SetUp NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
registry-url: https//npm.pkg.github.com | ||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8.11 | ||
- name: Git Identity | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Install | ||
run: pnpm install | ||
- name: Set Current Version | ||
run: | | ||
CURRENT_VERSION=${node -p 'require("./lerna.json").version'} | ||
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV | ||
- name: Tag Check | ||
id: tag_check | ||
run: | | ||
GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/v${CURRENT_VERSION}" | ||
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \ | ||
-H "Authorization: token ${GITHUB_TOKEN}") | ||
if [ "$https_status_code" -ne "404" ]; then | ||
echo "::set-output name=exists_tag::true" | ||
else | ||
echo "::set-output name=exists_tag::false" | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create GIT Tag | ||
if: steps.tag_check.outputs.exists_tag == 'false' && github.event.pull_request.merged == true | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ env.CURRENT_VERSION }} | ||
release_name: ${{ github.event.pull_request.title }} | ||
body: | | ||
${{ github.event.pull_request.body }} | ||
draft: false | ||
prerelease: false | ||
- name: Publish | ||
if: steps.tag_check.outputs.exists_tag == 'false' | ||
run: | | ||
pnpm lerna publish from-package --yes | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secret.GITHUB_TOKEN }} | ||
Check failure on line 75 in .github/workflows/publish.yml GitHub Actions / PublishInvalid workflow file
|
||
- uses: actions/github-scripts@v4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'https://github.com/${{ github.repository }}/release/tag/v${{ env.CURRENT_VERSION }} is released!!! ' | ||
}) |