mirror of
https://github.com/LeRoid-hub/Bookholder-API.git
synced 2025-01-31 02:34:57 +00:00
Create main.yml
This commit is contained in:
parent
a70fa3e124
commit
07868fbccb
61
.github/workflows/main.yml
vendored
Normal file
61
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# This workflow will build a golang project
|
||||||
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
|
||||||
|
|
||||||
|
name: Test & Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Use docker.io for Docker Hub if empty
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: leroid-hub/bookholder-api:latest
|
||||||
|
PAT: ${{ secrets.PAT }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
dind:
|
||||||
|
image: docker:23.0-rc-dind-rootless
|
||||||
|
ports:
|
||||||
|
- 2375:2375
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: "1.22"
|
||||||
|
|
||||||
|
- name: Test with Docker
|
||||||
|
run: go test -v ./...
|
||||||
|
|
||||||
|
|
||||||
|
- name: Actions Ntfy
|
||||||
|
run: |
|
||||||
|
curl \
|
||||||
|
-u ${{ secrets.NTFY_CRED }} \
|
||||||
|
-H "Title: Github bookholder API" \
|
||||||
|
-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