Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Seji64/LAPS-WebUI
Browse files Browse the repository at this point in the history
  • Loading branch information
Seji64 committed Jun 1, 2022
2 parents 0559b21 + 140e8bc commit 59c6e12
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 44 deletions.
90 changes: 75 additions & 15 deletions .github/workflows/ghcr_publish.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,85 @@
# This is a basic workflow to help you get started with Actions
name: GHCR Publish

name: GHCR Publish [manual]
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: '0 17 */10 * *'
push:
branches: [ main ]
paths-ignore:
- '**/README.md'
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ main ]
paths-ignore:
- '**/README.md'

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
docker:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- uses: actions/checkout@v2
name: Checkout repository

- name: Checkout repository
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
latest
- uses: pmorelli92/[email protected]
name: Build and Publish latest service image
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v3
with:
# Read note below to see how to generate the PAT
personal-access-token: ${{ secrets.GHCR_PAT }}
docker-image-name: LAPS-WebUI
docker-image-tag: latest
dockerfile-path: src/Dockerfile
build-context: ./src
context: ./src
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
33 changes: 4 additions & 29 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,7 @@ on:
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
docker:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 # Checking out the repo
with:
fetch-depth: 0
- run: |
git tag --list
git describe --tags --abbrev=0
- name: GHCR Build and push Docker image
uses: pmorelli92/[email protected]
with:
# Token that has `write:packages` scope to authenticate against GCHR.
personal-access-token: ${{ secrets.GHCR_PAT }}
# Docker Image name
docker-image-name: LAPS-WebUI
# Docker Image tag
docker-image-tag: latest
# Dockerfile path and name
dockerfile-path: src/Dockerfile
# Path to the build context
build-context: ./src
jobs:
release:
name: Release
strategy:
Expand All @@ -62,17 +37,17 @@ jobs:
git describe --tags --abbrev=0
- name: Setup dotnet
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v2
with:
dotnet-version: 5.0.x
dotnet-version: '6.0.x'

- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
release_name="LAPS-WebUI-$tag-${{ matrix.target }}"
# Build everything
dotnet publish src/LAPS-WebUI.csproj --self-contained --framework net5.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name"
dotnet publish src/LAPS-WebUI.csproj --self-contained --framework net6.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name"
# Pack files
if [ "${{ matrix.target }}" == "win-x64" ]; then
# Pack to zip for Windows
Expand Down

0 comments on commit 59c6e12

Please sign in to comment.