Bump yard from 0.9.26 to 0.9.35 #41
Workflow file for this run
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: CI/CD | |
on: | |
push: | |
paths-ignore: | |
- '*.md' | |
workflow_dispatch: | |
inputs: | |
create_release: | |
description: 'Create a release? Set to true' | |
required: true | |
push_gem: | |
description: 'Push gem? Set to true' | |
required: true | |
jobs: | |
editorconfig: | |
name: Check EditorConfig | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download editorconfig-checker | |
run: curl -O -L -C - https://github.com/editorconfig-checker/editorconfig-checker/releases/download/2.3.5/ec-linux-amd64.tar.gz | |
- name: Extract editorconfig-checker | |
run: tar xzf ec-linux-amd64.tar.gz | |
- name: Check EditorConfig compliance | |
run: ./bin/ec-linux-amd64 | |
build-and-test: | |
name: Build & test | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-ruby@v1 | |
with: | |
ruby-version: '2.7' | |
- name: Fetch Google Cloud credentials | |
run: echo "$CREDENTIALS" > credentials.json | |
env: | |
CREDENTIALS: ${{ secrets.TEST_GCLOUD_CREDENTIALS }} | |
- uses: actions/cache@v1 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Install Bundler 2 | |
run: gem install bundler -v '~> 2.1' --no-document | |
- name: Bundle install | |
run: | | |
set -x | |
bundle config set path vendor/bundle | |
bundle config set frozen true | |
bundle install --jobs 4 --retry 3 --without=development | |
bundle clean | |
- name: Run RSpec | |
run: bundle exec rspec | |
env: | |
TEST_GCLOUD_BUCKET: ${{ secrets.TEST_GCLOUD_BUCKET }} | |
TEST_GCLOUD_CREDENTIALS_PATH: credentials.json | |
- name: Run Rubocop | |
run: bundle exec rake rubocop | |
- name: Generate Yard API docs | |
run: bundle exec yard && touch doc/.nojekyll | |
- name: Generate Sorbet type definitions | |
run: mkdir defs && bundle exec sord defs/defs.rbi | |
- run: gem build distributed-lock-google-cloud-storage.gemspec | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: gem | |
path: '*.gem' | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: api-docs | |
path: doc | |
publish: | |
name: Publish | |
needs: | |
- editorconfig | |
- build-and-test | |
if: | | |
github.ref == 'refs/heads/test/ci-cd' | |
|| github.event.inputs.create_release == 'true' | |
|| github.event.inputs.push_gem == 'true' | |
runs-on: ubuntu-20.04 | |
environment: RubyGems.org | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fetch tags | |
run: git fetch --tags | |
- uses: actions/setup-ruby@v1 | |
with: | |
ruby-version: '2.7' | |
- uses: actions/download-artifact@v2 | |
with: | |
name: gem | |
path: . | |
- uses: actions/download-artifact@v2 | |
with: | |
name: api-docs | |
path: doc | |
- name: Determine version | |
id: determine_version | |
run: | | |
VERSION=$(ruby -r./lib/distributed-lock-google-cloud-storage/version -e 'puts DistributedLock::GoogleCloudStorage::Version::VERSION_STRING') | |
echo "::set-output name=version::$VERSION" | |
- name: Determine changelog | |
run: | | |
MERGE_BASE=$(git merge-base origin/main HEAD) | |
echo "Merge base: $MERGE_BASE" | |
if PREVIOUS_RELEASE_TAG=$(git describe "$MERGE_BASE" --tags --abbrev=0 --match='v*' 2>/dev/null); then | |
echo "Previous release: $PREVIOUS_RELEASE_TAG" | |
git log --pretty='format:%s' "$PREVIOUS_RELEASE_TAG..HEAD" | sed -E 's|(.*)| * \1|' > changelog.txt | |
else | |
echo "No previous release found" | |
git log --pretty='format:%s' | sed -E 's|(.*)| * \1|' > changelog.txt | |
fi | |
echo | |
echo "## Changelog" | |
cat changelog.txt | |
- name: Create tag | |
if: github.event.inputs.create_release == 'true' | |
run: | | |
set -x | |
git tag "v${PRODUCT_VERSION}" | |
git push origin "v${PRODUCT_VERSION}" | |
env: | |
PRODUCT_VERSION: ${{ steps.determine_version.outputs.version }} | |
- name: Create draft release | |
if: github.event.inputs.create_release == 'true' | |
run: gh release create "v${PRODUCT_VERSION}" --draft --notes-file changelog.txt --title "Version $PRODUCT_VERSION" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PRODUCT_VERSION: ${{ steps.determine_version.outputs.version }} | |
- name: Upload release assets | |
if: github.event.inputs.create_release == 'true' | |
run: gh release upload --clobber "v${PRODUCT_VERSION}" *.gem | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PRODUCT_VERSION: ${{ steps.determine_version.outputs.version }} | |
- name: Publish API docs | |
if: github.event.inputs.create_release == 'true' | |
uses: JamesIves/github-pages-deploy-action@0f24da7de3e7e135102609a4c9633b025be8411b | |
with: | |
branch: gh-pages | |
folder: doc | |
- name: Push gem | |
if: github.event.inputs.push_gem == 'true' | |
uses: dawidd6/action-publish-gem@c4713bf1595e0686322d6cf6c1a1c0dcaeca55de | |
with: | |
api_key: ${{ secrets.RUBYGEMS_API_KEY }} |