refactor: update GitHub actions #98
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: build, test and deploy | |
on: [ push, pull_request ] | |
jobs: | |
test: | |
# In order to avoid running this with 'mob next' | |
if: "!contains(github.event.head_commit.message, 'skip-ci')" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Enable corepack and install yarn | |
run: corepack enable && corepack prepare [email protected] --activate | |
- name: Install dependencies and build web app | |
run: make build-web | |
- name: Install golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.4 # Same version as set in Dockerfile | |
- name: Run linter | |
uses: golangci/golangci-lint-action@v6 | |
- name: Run tests | |
run: make coverage | |
- name: Prepare coverage report | |
uses: jandelgado/[email protected] | |
- name: Send coverage report | |
uses: coverallsapp/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: coverage.lcov | |
deploy: | |
# Only run this in case building and testing succeeded, and the event is a push to master | |
if: "${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}" | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # do a full, so not a shallow, clone | |
- name: Push to dokku | |
uses: dokku/[email protected] | |
with: | |
git_push_flags: "--force" | |
git_remote_url: "ssh://[email protected]:22/cassette" | |
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }} |