mirror of
https://github.com/XLabsProject/s1x-client.git
synced 2023-08-02 15:02:12 +02:00
Add github workflows
This commit is contained in:
parent
69fdcd6da1
commit
2ae1704d9d
216
.github/workflows/build.yml
vendored
Normal file
216
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,216 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "*"
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
types: [closed, opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
modify:
|
||||
runs-on: ubuntu-latest
|
||||
name: Apply Git modifications if any are necessary
|
||||
steps:
|
||||
- name: Check out files
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: false
|
||||
lfs: false
|
||||
|
||||
# Set up committer info and GPG key
|
||||
- name: Import GPG key
|
||||
if: github.event.pull_request.merged
|
||||
id: import_gpg
|
||||
uses: XLabsProject/ghaction-import-gpg@25d9d6ab99eb355c169c33c2306a72df85d9f516
|
||||
with:
|
||||
git-commit-gpgsign: true
|
||||
git-committer-email: "${{ secrets.XLABS_CI_EMAIL }}"
|
||||
git-committer-name: "${{ secrets.XLABS_CI_NAME }}"
|
||||
git-push-gpgsign: false
|
||||
git-tag-gpgsign: true
|
||||
git-user-signingkey: true
|
||||
gpg-private-key: ${{ secrets.XLABS_CI_GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.XLABS_CI_GPG_PASSWORD }}
|
||||
|
||||
- name: Extract version from changelog
|
||||
if: github.event.pull_request.merged
|
||||
id: changelog_reader
|
||||
uses: mindsers/changelog-reader-action@v2
|
||||
with:
|
||||
validation_depth: 10
|
||||
path: ./CHANGELOG.md
|
||||
|
||||
- name: Create annotated tag
|
||||
if: github.event.pull_request.merged
|
||||
run: |
|
||||
git tag -a -m "${{ steps.changelog_reader.outputs.changes }}" \
|
||||
"${{ steps.changelog_reader.outputs.version }}" \
|
||||
"${{ github.event.pull_request.merge_commit_sha }}"
|
||||
git push origin --tags
|
||||
|
||||
build:
|
||||
name: Build binaries
|
||||
runs-on: windows-latest
|
||||
needs:
|
||||
- modify
|
||||
strategy:
|
||||
matrix:
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
steps:
|
||||
- name: Check out files
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
# NOTE - if LFS ever starts getting used during builds, switch this to true!
|
||||
lfs: false
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
|
||||
- name: Generate project files
|
||||
run: tools/premake5 vs2019
|
||||
|
||||
- name: Set up problem matching
|
||||
uses: ammaraskar/msvc-problem-matcher@master
|
||||
|
||||
- name: Build ${{matrix.configuration}} binaries
|
||||
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=x64 build/iw6x.sln
|
||||
|
||||
- name: Upload ${{matrix.configuration}} binaries
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{matrix.configuration}} binaries
|
||||
path: |
|
||||
build/bin/x64/${{matrix.configuration}}/*
|
||||
|
||||
- name: Upload ${{matrix.configuration}} debug symbols
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{matrix.configuration}} debug symbols
|
||||
path: |
|
||||
build/bin/**/*.pdb
|
||||
|
||||
release:
|
||||
name: Create new GitHub Release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request.merged
|
||||
steps:
|
||||
- name: Check out files
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: false
|
||||
lfs: false
|
||||
|
||||
- name: Download Release binaries
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: Release binaries
|
||||
|
||||
# Set up committer info and GPG key
|
||||
- name: Import GPG key
|
||||
id: import_gpg
|
||||
uses: XLabsProject/ghaction-import-gpg@25d9d6ab99eb355c169c33c2306a72df85d9f516
|
||||
with:
|
||||
git-commit-gpgsign: true
|
||||
git-committer-email: "${{ secrets.XLABS_CI_EMAIL }}"
|
||||
git-committer-name: "${{ secrets.XLABS_CI_NAME }}"
|
||||
git-push-gpgsign: false
|
||||
git-tag-gpgsign: true
|
||||
git-user-signingkey: true
|
||||
gpg-private-key: ${{ secrets.XLABS_CI_GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.XLABS_CI_GPG_PASSWORD }}
|
||||
|
||||
- name: Extract version from changelog
|
||||
id: changelog_reader
|
||||
uses: mindsers/changelog-reader-action@v2
|
||||
with:
|
||||
validation_depth: 2
|
||||
path: ./CHANGELOG.md
|
||||
|
||||
- uses: papeloto/action-zip@v1
|
||||
with:
|
||||
recursive: false
|
||||
files: iw6x.exe
|
||||
dest: iw6x-${{ steps.changelog_reader.outputs.version }}.zip
|
||||
- name: Sign ZIP file
|
||||
run: gpg --output "iw6x-${{ steps.changelog_reader.outputs.version }}.zip.sig" --detach-sig "iw6x-${{ steps.changelog_reader.outputs.version }}.zip"
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.XLABS_CI_GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ steps.changelog_reader.outputs.version }}
|
||||
release_name: ${{ steps.changelog_reader.outputs.version }}
|
||||
body: ${{ steps.changelog_reader.outputs.changes }}
|
||||
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
|
||||
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
|
||||
|
||||
- name: Upload Release ZIP
|
||||
id: upload-release-zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.XLABS_CI_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ github.workspace }}/iw6x-${{ steps.changelog_reader.outputs.version }}.zip
|
||||
asset_name: iw6x-${{ steps.changelog_reader.outputs.version }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Upload Release ZIP signature
|
||||
id: upload-release-zip-signature
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.XLABS_CI_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ github.workspace }}/iw6x-${{ steps.changelog_reader.outputs.version }}.zip.sig
|
||||
asset_name: iw6x-${{ steps.changelog_reader.outputs.version }}.zip.sig
|
||||
asset_content_type: text/plain
|
||||
|
||||
- name: Remove extra files
|
||||
run: git clean -ffdx && git reset --hard
|
||||
|
||||
- name: Create Pull Request to merge master back into develop
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.XLABS_CI_GITHUB_TOKEN }}
|
||||
with:
|
||||
delete-branch: false
|
||||
author: "${{ secrets.XLABS_CI_NAME }} <${{ secrets.XLABS_CI_EMAIL }}>"
|
||||
committer: "${{ secrets.XLABS_CI_NAME }} <${{ secrets.XLABS_CI_EMAIL }}>"
|
||||
branch: release/${{ steps.changelog_reader.outputs.version }}
|
||||
base: develop
|
||||
body: |
|
||||
This Pull Request contains all changes done for the release of ${{ steps.changelog_reader.outputs.version }}, ready to be merged back into `master`.
|
||||
|
||||
This release should be merged in due time to make sure that changes done to files such as the changelog as part of the release are also contained on the `develop` branch.
|
||||
title: Merge ${{ steps.changelog_reader.outputs.version }} into develop
|
||||
|
||||
notify:
|
||||
name: Notify Discord
|
||||
runs-on: ubuntu-latest
|
||||
if: |
|
||||
github.repository_owner == 'XLabsProject' && (
|
||||
(
|
||||
github.event.pull_request.merged
|
||||
) || (
|
||||
github.event.push.ref == 'refs/heads/master' ||
|
||||
github.event.push.ref == 'refs/heads/develop'
|
||||
)
|
||||
)
|
||||
steps:
|
||||
- name: Post CI status notification to Discord
|
||||
uses: sarisia/actions-status-discord@v1.7.1
|
||||
if: always()
|
||||
with:
|
||||
webhook: ${{ secrets.DISCORD_CI_BOT_WEBHOOK }}
|
||||
title: "Build"
|
17
.github/workflows/discord-notify.yml
vendored
Normal file
17
.github/workflows/discord-notify.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
name: Notify Discord
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "*"
|
||||
issues:
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'XLabsProject'
|
||||
steps:
|
||||
- name: Send notification to Discord
|
||||
uses: Ilshidur/action-discord@master
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_CI_BOT_WEBHOOK }}
|
82
.github/workflows/draft-new-release.yml
vendored
Normal file
82
.github/workflows/draft-new-release.yml
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
name: "Draft new release"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "The version you want to release."
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
draft-new-release:
|
||||
name: "Draft a new release"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Normalize version
|
||||
id: normalize_version
|
||||
run: |
|
||||
version="${{ github.event.inputs.version }}"
|
||||
version="v${version#v}"
|
||||
echo "::set-output name=version::$version"
|
||||
|
||||
# Set up committer info and GPG key
|
||||
- name: Import GPG key
|
||||
id: import_gpg
|
||||
uses: XLabsProject/ghaction-import-gpg@25d9d6ab99eb355c169c33c2306a72df85d9f516
|
||||
with:
|
||||
git-commit-gpgsign: true
|
||||
git-committer-email: "${{ secrets.XLABS_CI_EMAIL }}"
|
||||
git-committer-name: "${{ secrets.XLABS_CI_NAME }}"
|
||||
# git-push-gpgsign: true
|
||||
git-tag-gpgsign: true
|
||||
git-user-signingkey: true
|
||||
gpg-private-key: ${{ secrets.XLABS_CI_GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.XLABS_CI_GPG_PASSWORD }}
|
||||
|
||||
- name: Rename Unreleased section in changelog to ${{ steps.normalize_version.outputs.version }}
|
||||
uses: thomaseizinger/keep-a-changelog-new-release@1.1.0
|
||||
with:
|
||||
version: ${{ steps.normalize_version.outputs.version }}
|
||||
|
||||
- name: Commit changelog
|
||||
id: make-commit
|
||||
run: |
|
||||
git checkout -b "release/${{ steps.normalize_version.outputs.version }}"
|
||||
git add CHANGELOG.md
|
||||
git commit -S -m "Prepare release ${{ steps.normalize_version.outputs.version }}"
|
||||
git push -u origin "release/${{ steps.normalize_version.outputs.version }}"
|
||||
|
||||
echo "::set-output name=commit::$(git rev-parse HEAD)"
|
||||
|
||||
- name: Extract changelog for Pull Request
|
||||
id: changelog_reader
|
||||
uses: mindsers/changelog-reader-action@v2
|
||||
with:
|
||||
validation_depth: 10
|
||||
version: ${{ steps.normalize_version.outputs.version }}
|
||||
path: ./CHANGELOG.md
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: repo-sync/pull-request@v2
|
||||
with:
|
||||
github_token: ${{ secrets.XLABS_CI_GITHUB_TOKEN }}
|
||||
source_branch: "release/${{ steps.normalize_version.outputs.version }}"
|
||||
destination_branch: "master"
|
||||
pr_body: |
|
||||
This Pull Request is for the release of IW6x ${{ steps.normalize_version.outputs.version }} and was [automatically created by a workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) triggered by @${{ github.actor }}.
|
||||
|
||||
Commit [`${{ steps.make-commit.outputs.commit }}`](https://github.com/${{ github.repository }}/commit/${{ steps.make-commit.outputs.commit }}) includes an update to the changelog to list the new version with its changes.
|
||||
|
||||
# What happens when this PR gets merged?
|
||||
|
||||
After merging this PR, another workflow will create a new tag `${{ steps.normalize_version.outputs.version }}` on the `master` branch and the version will officially be ${{ steps.changelog_reader.outputs.status }} via an actual GitHub release. A final build will be triggered and all binaries and assets will be attached to the GitHub release.
|
||||
|
||||
# Changelog for ${{ steps.normalize_version.outputs.version }}
|
||||
|
||||
These changes will be included in the release:
|
||||
|
||||
${{ steps.changelog_reader.outputs.changes }}
|
||||
pr_title: Release ${{ steps.changelog_reader.outputs.version }}
|
||||
pr_label: release
|
Loading…
Reference in New Issue
Block a user