This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ceabf50
commit 480a094
Showing
2 changed files
with
13 additions
and
84 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Tag and Release | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
@@ -9,62 +9,11 @@ on: | |
- "lib/mathematical/version.rb" | ||
|
||
jobs: | ||
release: | ||
env: | ||
GEM_NAME: mathematical | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_BOT_KEY }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Ruby 3.1 | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.1 | ||
bundler-cache: true | ||
|
||
- name: Configure Git | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Actions Auto Build" | ||
- name: Get current version | ||
id: version-label | ||
run: | | ||
VERSION=$(grep VERSION lib/mathematical/version.rb | head -n 1 | cut -d'"' -f2) | ||
echo "version=${VERSION}" >> $GITHUB_OUTPUT | ||
- name: Create tag | ||
run: | | ||
git tag -a v${{ steps.version-label.outputs.version }} -m "Release v${{ steps.version-label.outputs.version }}" | ||
git push origin --tags | ||
- name: Generate CHANGELOG.md | ||
id: changelog | ||
run: script/generate_changelog | ||
|
||
- name: Commit & Push Changelog | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Actions Auto Build" | ||
git add -f CHANGELOG.md | ||
git commit -m "docs: update changelog" || true | ||
git push | ||
- name: Publish release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh release create v${{ steps.version-label.outputs.version }} --generate-notes | ||
- name: Publish to RubyGems | ||
run: | | ||
mkdir -p $HOME/.gem | ||
touch $HOME/.gem/credentials | ||
chmod 0600 $HOME/.gem/credentials | ||
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials | ||
bundle exec rake package | ||
for gem in pkg/mathematical-${{ steps.version-label.outputs.version }}*.gem ; do | ||
gem push "$gem" --host https://rubygems.org | ||
done | ||
ruby: | ||
uses: yettoapp/actions/.github/workflows/ruby_gem_release.yml@main | ||
secrets: | ||
rubygems_api_key: ${{ secrets.RUBYGEMS_API_BOT_KEY }} | ||
gh_token: ${{ secrets.PUBLIC_PUSH_TO_PROTECTED_BRANCH }} | ||
with: | ||
gem_name: mathematical | ||
version_filepath: lib/mathematical/version.rb |