mirror of
https://github.com/freedbygrace/ActiveDirectoryToRestApi.git
synced 2026-07-27 11:59:01 +00:00
Add GH action / Dockerfile adjust
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
strategy:
|
||||
matrix:
|
||||
kind: ['linux', 'linux-arm', 'linux-arm64', 'windows', 'macOS']
|
||||
include:
|
||||
- kind: linux
|
||||
os: ubuntu-latest
|
||||
target: linux-x64
|
||||
- kind: linux-arm
|
||||
os: ubuntu-latest
|
||||
target: linux-arm
|
||||
- kind: linux-arm64
|
||||
os: ubuntu-latest
|
||||
target: linux-arm64
|
||||
- kind: windows
|
||||
os: windows-latest
|
||||
target: win-x64
|
||||
- kind: macOS
|
||||
os: macos-latest
|
||||
target: osx-x64
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
tag=$(git describe --tags --abbrev=0)
|
||||
release_name="ActiveDirectoryToRestApi-$tag-${{ matrix.target }}"
|
||||
|
||||
dotnet publish src/ActiveDirectoryToRestApi/ActiveDirectoryToRestApi.csproj --framework net8.0 --runtime "${{ matrix.target }}" --no-self-contained -p:PublishSingleFile=true -c Release -o "$release_name"
|
||||
|
||||
if [ "${{ matrix.target }}" == "win-x64" ]; then
|
||||
7z a -tzip "${release_name}.zip" "./${release_name}/*"
|
||||
else
|
||||
tar czvf "${release_name}.tar.gz" "$release_name"
|
||||
fi
|
||||
|
||||
rm -r "$release_name"
|
||||
|
||||
- name: Publish
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: "ActiveDirectoryToRestApi-*"
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
build:
|
||||
name: Build image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
zimbres/activedirectory-to-restapi
|
||||
flavor: |
|
||||
latest=true
|
||||
tags: |
|
||||
type=ref,event=tag
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
registry: docker.io
|
||||
|
||||
- name: Build and Push Image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: src/ActiveDirectoryToRestApi/Dockerfile
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
push: true
|
||||
Reference in New Issue
Block a user