Skip to content

Commit

Permalink
Merge pull request #93 from openameba/feature/maintenance-release-wor…
Browse files Browse the repository at this point in the history
…kflow

maintenance release workflow
  • Loading branch information
sasaplus1 authored Jul 28, 2023
2 parents c9806c7 + fc132a0 commit 0d2ec79
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,41 @@ jobs:
releasing:
name: releasing
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pull-requests: write
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v2-beta
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: npm
registry-url: 'https://registry.npmjs.org'
- name: Set git user
run: |
git config --global user.email "<>"
git config --global user.name "openameba"
- name: Log in to npm
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm whoami
- name: Extract branch from git ref
run: |
echo "::set-output name=name::${GITHUB_REF#refs/*/}"
echo "::set-output name=version::${GITHUB_REF##*/}"
id: extract_branch
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Versioning
run: npm version ${{ steps.extract_branch.outputs.version }}
run: npm version "${GITHUB_REF##*/}"
- name: Publish to npm
run: npm publish
run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push updates
run: |
git push origin ${{ steps.extract_branch.outputs.name }}
git push origin ${{ github.ref_name }}
git push origin --tags
- name: Create Pull Request
run: >
curl
-X POST
-H "Accept: application/vnd.github.v3+json"
-H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}"
https://api.github.com/repos/${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}/pulls
-d '{"head":"${{ steps.extract_branch.outputs.name }}","base":"${{ github.event.repository.default_branch }}","title":"chore(release): publish"}'
gh pr create
--assignee
--base "${{ github.event.repository.default_branch }}"
--body ''
--head "${{ github.ref_name }}"
--title "chore(release): publish"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 0d2ec79

Please sign in to comment.