mirror of
https://github.com/EndPositive/slipstream.git
synced 2025-10-08 12:25:04 +00:00
Add GH CI for releases
This commit is contained in:
parent
38654ca9eb
commit
734f23fba3
2 changed files with 112 additions and 0 deletions
110
.github/workflows/release.yaml
vendored
Normal file
110
.github/workflows/release.yaml
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
name: Release slipstream
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt install -y pkg-config libssl-dev ninja-build
|
||||
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
|
||||
-DCMAKE_MAKE_PROGRAM=ninja \
|
||||
-DCMAKE_C_COMPILER=clang \
|
||||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
-G Ninja \
|
||||
-S ${{github.workspace}} \
|
||||
-B ${{github.workspace}}/build
|
||||
|
||||
- name: Build with CMake
|
||||
run: |
|
||||
cmake \
|
||||
--build ${{github.workspace}}/build \
|
||||
-j $(nproc) \
|
||||
--target slipstream-client slipstream-server
|
||||
|
||||
- name: Rename Binaries
|
||||
run: |
|
||||
VERSION=${{ github.ref_name }}
|
||||
mv ${{github.workspace}}/build/slipstream-client ${{github.workspace}}/build/slipstream-client-${VERSION}-linux-x86_64
|
||||
mv ${{github.workspace}}/build/slipstream-server ${{github.workspace}}/build/slipstream-server-${VERSION}-linux-x86_64
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: github.ref_type == 'tag'
|
||||
with:
|
||||
draft: true
|
||||
generate_release_notes: true
|
||||
files: |
|
||||
build/slipstream-client-*
|
||||
build/slipstream-server-*
|
||||
|
||||
docker-build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
attestations: write
|
||||
id-token: write
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push Docker image
|
||||
id: push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Generate artifact attestation
|
||||
uses: actions/attest-build-provenance@v2
|
||||
with:
|
||||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
subject-digest: ${{ steps.push.outputs.digest }}
|
||||
push-to-registry: true
|
||||
|
|
@ -41,4 +41,6 @@ ENV PATH=/usr/src/app/:$PATH
|
|||
COPY --from=builder --chmod=755 /usr/src/app/slipstream-client ./client
|
||||
COPY --from=builder --chmod=755 /usr/src/app/slipstream-server ./server
|
||||
|
||||
LABEL org.opencontainers.image.source https://github.com/EndPositive/slipstream
|
||||
|
||||
ENTRYPOINT []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue