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

[CI/CD] Tag release on version.rb change #30

Merged
merged 2 commits into from
Apr 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
name: Publish Gem
name: Tag and Release

on:
workflow_dispatch:
push:
tags:
- v**
branches:
- master
paths:
- "lib/turbo_tests/version.rb"

jobs:
build:
name: Build + Publish
release:
name: Tag and Release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
- name: Set up Ruby 2.6
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
ruby-version: 2.7
bundler-cache: true

- name: Run tests
Expand All @@ -32,6 +35,28 @@ jobs:
name: "ruby-gem"
path: "pkg/*.gem"

- 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/turbo_tests/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: Publish release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ steps.version-label.outputs.version }} --generate-notes

- name: Publish to GPR
run: |
mkdir -p $HOME/.gem
Expand Down