50 lines
1.1 KiB
YAML
50 lines
1.1 KiB
YAML
name: Test and Build Docker Image
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: "0 0 * * *"
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
env:
|
|
DISCORD_TOKEN: 0
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "stable"
|
|
- run: go test ./... -v
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
env:
|
|
DISCORD_TOKEN: 0
|
|
if: github.event_name != 'pull_request'
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: docker/setup-buildx-action@v3
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: |
|
|
ghcr.io/thelovinator1/anewdawn:latest
|