Skip to content

Merge pull request #1 from mbta/cbj/errors #2

Merge pull request #1 from mbta/cbj/errors

Merge pull request #1 from mbta/cbj/errors #2

Workflow file for this run

name: Test, Docs, Release
on:
push:
branches:
- main
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
name: Test & Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v4
- uses: erlef/setup-beam@v1
with:
otp-version: 27.0
elixir-version: 1.17.0
- run: mix deps.get
- run: mix test --cover
- run: mix docs
- uses: actions/upload-pages-artifact@v3
with:
path: ./docs
deploy:
concurrency:
group: "pages"
cancel-in-progress: true
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
release:
# only if the commit message says so
if: startsWith(github.event.head_commit.message, 'release')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Parse release tag name
id: tag
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
run:
if [[ "${{ env.COMMIT_MSG }}" =~ (v[0-9]+.[0-9]+.[0-9]+) ]]; then
echo "name=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT;
fi
- name: Create Release
uses: actions/github-script@v7
if: steps.tag.outputs.name
with:
script: |
const { owner, repo } = context.repo
await github.rest.repos.createRelease({
owner,
repo,
tag_name: "${{ steps.tag.outputs.name }}",
target_commitish: "${{ github.sha }}",
draft: false,
prerelease: false,
generate_release_notes: true
})