mirror of
https://github.com/LeRoid-hub/Mensa-API.git
synced 2025-01-31 03:34:57 +00:00
Create gotestnbuild.yml
This commit is contained in:
parent
69e3b61198
commit
4e8d98aa13
51
.github/workflows/gotestnbuild.yml
vendored
Normal file
51
.github/workflows/gotestnbuild.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
name: Go Tests & Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
|
||||
env:
|
||||
# Use docker.io for Docker Hub if empty
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: leroid-hub/mensa-api:latest
|
||||
PAT: ${{ secrets.PAT }}
|
||||
|
||||
jobs:
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.23'
|
||||
|
||||
- name: Build
|
||||
run: go build -v ./...
|
||||
- name: Actions Ntfy
|
||||
run: |
|
||||
curl \
|
||||
-u ${{ secrets.NTFY_CRED }} \
|
||||
-H "Title: Github barfuss.email" \
|
||||
-H "Content-Type: text/plain" \
|
||||
-d $'Repo: ${{ github.repository }}\nCommit: ${{ github.sha }} - ${{ github.event.head_commit.message }}\nRef: ${{ github.ref }}\nStatus: ${{ job.status}}' \
|
||||
${{ secrets.NTFY_URL }}
|
||||
|
||||
# - name: Test
|
||||
# run: go test -v ./...
|
||||
|
||||
build:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Login
|
||||
run: |
|
||||
echo ${{ env.PAT }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
- name: Build and Publish
|
||||
run: |
|
||||
docker build . --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
Loading…
Reference in New Issue
Block a user