Skip to content

Commit 7304c07

Browse files
added workflow templates
1 parent 16a0eec commit 7304c07

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.github/workflows/build.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: Build and Test
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
env:
17+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
18+
19+
permissions:
20+
packages: read
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
- name: Setup .NET
25+
uses: actions/setup-dotnet@v3
26+
with:
27+
dotnet-version: 7.0.x
28+
source-url: https://nuget.pkg.github.com/justfaas/index.json
29+
env:
30+
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
- name: Restore dependencies
32+
run: dotnet restore src
33+
- name: Build
34+
run: dotnet build --no-restore src
35+
# - name: Test
36+
# run: dotnet test --no-build --verbosity normal tests

.github/workflows/publish.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags: [ "v*" ]
6+
7+
jobs:
8+
publish:
9+
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
packages: write
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v2
19+
- name: Login to GitHub Container Registry
20+
uses: docker/login-action@v2
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.repository_owner }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
- id: prep
26+
run: |
27+
DOCKER_IMAGE=ghcr.io/justfaas/metrics
28+
VERSION=${GITHUB_REF#refs/tags/}
29+
VERSION=${VERSION#v}
30+
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:latest"
31+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
32+
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
33+
- name: Build and push Docker image
34+
id: docker_build
35+
uses: docker/build-push-action@v4
36+
with:
37+
push: true
38+
tags: ${{ steps.prep.outputs.tags }}
39+
platforms: linux/amd64,linux/arm64
40+
secrets: |
41+
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
42+
- name: Create GitHub Release
43+
uses: softprops/action-gh-release@v1
44+
with:
45+
draft: true
46+
tag_name: ${{ github.ref_name }}
47+
generate_release_notes: true
48+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)