chore: bump github/codeql-action from 2 to 3 (#229) #123
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 Package to rubygems.org and GitHub Registry | |
on: | |
push: | |
branches: | |
- "master" | |
jobs: | |
release-to-registries: | |
runs-on: ubuntu-latest | |
# The release workflow should only be triggered by conventional | |
# tags. For details, see the Angular contributing documentation at: | |
# https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format | |
if: | | |
startsWith(github.event.head_commit.message, 'build') | |
|| startsWith(github.event.head_commit.message, 'ci') | |
|| startsWith(github.event.head_commit.message, 'docs') | |
|| startsWith(github.event.head_commit.message, 'feat') | |
|| startsWith(github.event.head_commit.message, 'fix') | |
|| startsWith(github.event.head_commit.message, 'perf') | |
|| startsWith(github.event.head_commit.message, 'refactor') | |
|| startsWith(github.event.head_commit.message, 'test') | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PACKAGE_REGISTRY_TOKEN }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "14" | |
- uses: actions/[email protected] | |
with: | |
ruby-version: "2.6" | |
- name: run semantic release | |
run: | | |
cp README.md docs/README.md | |
cp SECURITY.md docs/security.md | |
cp CODE_OF_CONDUCT.md docs/code.md | |
npm install && npm run release | |
env: | |
GIT_AUTHOR_NAME: tianhaoz95 | |
GIT_AUTHOR_EMAIL: [email protected] | |
GIT_COMMITTER_NAME: tianhaoz95 | |
GIT_COMMITTER_EMAIL: [email protected] | |
GITHUB_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }} | |
GEM_HOST_API_KEY: ${{ secrets.RUBY_GEMS_TOKEN }} | |
- name: setup release credentials | |
env: | |
RELEASE_TOKEN: ${{ secrets.RUBY_GEMS_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }} | |
run: | | |
rm -rf ~/.gem/credentials | |
mkdir -p ~/.gem | |
echo "---" > ~/.gem/credentials | |
echo ":github: Bearer ${GITHUB_TOKEN}" >> ~/.gem/credentials | |
echo ":rubygems_api_key: ${RELEASE_TOKEN}" >> ~/.gem/credentials | |
chmod 0600 ~/.gem/credentials | |
- name: upload to registries | |
env: | |
GITHUB_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }} | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Tianhao Zhou" | |
echo "machine github.com login tianhaoz95 password $GITHUB_TOKEN" > ~/.netrc | |
bundle install | |
rake install | |
gem push pkg/*.gem | |
gem push --key github --host https://rubygems.pkg.github.com/tianhaoz95 pkg/*.gem |