summaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: 6ad8a942a5c88d1b3e9300b4e1494fb736219518 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Release
on:
  workflow_dispatch:
    inputs:
      release-version:
        description: Enter version to release (e.g., 2.1.0).
        required: false
      release-beer:
        default: TBD
        description: Enter beer to mark the occasion.
        required: false
jobs:
  activate:
    runs-on: ubuntu-latest
    if: github.repository_owner == 'asciidoctor' && github.event_name == 'workflow_dispatch'
    steps:
    - run: echo ok go
  perform:
    needs: activate
    runs-on: ubuntu-latest
    environment: releases
    env:
      SOURCE_DATE_EPOCH: '1521504000'
      PYGMENTS_VERSION: '~> 2.0'
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Install Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: '3.1'
        bundler-cache: false
    - name: Configure Bundler
      run: |
        bundle config --local path .bundle/gems
        bundle config --local without coverage docs
    - name: Install dependencies
      run: bundle --jobs 3 --retry 3
    - name: Run tests
      run: bundle exec rake test:all
    - name: Run linter
      run: bundle exec rake lint
    - name: Setup release environment
      run: |
        echo ${{ secrets[format('GH_TOKEN_{0}', github.actor)] }} | gh auth login --with-token
        echo RELEASE_VERSION=${{ github.event.inputs.release-version }} >> $GITHUB_ENV
        echo RELEASE_BEER=${{ toJSON(github.event.inputs.release-beer) }} >> $GITHUB_ENV
        echo RELEASE_RUBYGEMS_API_KEY=${{ secrets[format('RUBYGEMS_API_KEY_{0}', github.actor)] }} >> $GITHUB_ENV
    - name: Build, tag, and publish gem
      run: ./release.sh