Skip to content

Commit

Permalink
added workflow templates
Browse files Browse the repository at this point in the history
  • Loading branch information
goncalo-oliveira committed Jun 15, 2023
1 parent 82ae832 commit bcda430
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Build and Test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1

permissions:
packages: read

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
source-url: https://nuget.pkg.github.com/justfaas/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore dependencies
run: dotnet restore src
- name: Build
run: dotnet build --no-restore src
# - name: Test
# run: dotnet test --no-build --verbosity normal tests
48 changes: 48 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish

on:
push:
tags: [ "v*" ]

jobs:
publish:

runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: prep
run: |
DOCKER_IMAGE=ghcr.io/justfaas/idler
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v}
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:latest"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ steps.prep.outputs.tags }}
platforms: linux/amd64,linux/arm64
secrets: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
draft: true
tag_name: ${{ github.ref_name }}
generate_release_notes: true
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit bcda430

Please sign in to comment.