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

maintenance release workflow #93

Merged
merged 2 commits into from
Jul 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 20 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,37 @@ jobs:
releasing:
name: releasing
runs-on: ubuntu-latest
timeout-minutes: 10
Copy link
Member Author

Choose a reason for hiding this comment

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

タイムアウト追加

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v2-beta
- uses: actions/setup-node@v3
Copy link
Member Author

Choose a reason for hiding this comment

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

バージョン上げ

with:
node-version: 16
node-version: 18
cache: npm
registry-url: 'https://registry.npmjs.org'
Comment on lines +29 to +31
Copy link
Member Author

Choose a reason for hiding this comment

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

  • バージョン上げ
  • キャッシュを使う
  • .npmrc の設定をsetup-nodeにさせる

Copy link
Contributor

Choose a reason for hiding this comment

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

nodeバージョン上げてますしリリースフロー確認がてらリリースしますか・・:eyes:

- 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'
Comment on lines +34 to +35
Copy link
Member Author

@sasaplus1 sasaplus1 Jul 19, 2023

Choose a reason for hiding this comment

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

GitHub Actions のアカウントとして設定する(と、見た目がカッコイイ)

- 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
tokimari marked this conversation as resolved.
Show resolved Hide resolved
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"
Comment on lines +48 to +53
Copy link
Member Author

Choose a reason for hiding this comment

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

curlで頑張ってPOSTするよりかは現代ではghがあるのでそれを使う
https://github.com/peter-evans/create-pull-request を使うのでもよかったかもしれない

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}