feat: Add action description to UI #168
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: Test | |
permissions: | |
contents: write | |
packages: write | |
on: [push] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:12.3-alpine | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_PASSWORD: secret | |
POSTGRES_USER: krab | |
POSTGRES_DB: krab | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.4 | |
- uses: actions/cache@v3 | |
if: ${{ !env.ACT }} | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Run tests | |
env: | |
DATABASE_URL: "postgres://krab:secret@localhost:5432/krab?sslmode=disable&prefer_simple_protocol=true" | |
run: | | |
mkdir -p bin/ | |
make install | |
make gen | |
go test -v ./... | |
release: | |
runs-on: ubuntu-latest | |
needs: test | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to Github Packages | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set tag | |
run: echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Build image and push to GitHub Container Registry | |
uses: docker/build-push-action@v4 | |
with: | |
# relative path to the place where source code with Dockerfile is located | |
context: . | |
push: true | |
tags: | | |
ghcr.io/ohkrab/krab:${{ env.IMAGE_TAG }} | |
qbart/krab:${{ env.IMAGE_TAG }} | |
build-args: | | |
BUILD_VERSION=${{ env.IMAGE_TAG }} | |
BUILD_COMMIT=${{ github.sha }} | |
BUILD_DATE=${{ github.event.repository.updated_at }} | |
- | |
name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.4 | |
- | |
name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |