Skip to content

CI: actions/download-artifact from 3.0.1 to 4.1.7 #75

CI: actions/download-artifact from 3.0.1 to 4.1.7

CI: actions/download-artifact from 3.0.1 to 4.1.7 #75

name: nightly-builds
on: push
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
cmake_preset: ci-windows-x86
build_conf: Debug
env:
# Indicates the location of the vcpkg as a Git submodule of the project repository.
VCPKG_ROOT: ${{ github.workspace }}/external/vcpkg
# Tells vcpkg where binary packages are stored.
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/external/vcpkg/bincache
# Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature.
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
steps:
# Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage
# for Binary Caching.
- name: Set env vars needed for vcpkg to leverage the GitHub Action cache
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Create build environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'"
shell: bash
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching
# when it is being run afterwards by CMake.
- name: Restore vcpkg
uses: actions/cache@v3
with:
# The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the
# built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var.
# The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages.
path: |
${{ env.VCPKG_ROOT }}
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
!${{ env.VCPKG_ROOT }}/installed
# The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used.
key: |
${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{github.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE --preset ${{ matrix.cmake_preset }} -DCMAKE_BUILD_TYPE=${{ matrix.build_conf }}
- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config ${{ matrix.build_conf }}
- name: Prepare artifacts
run: |
mkdir publish\
move build\${{matrix.build_conf}}\bin\gsm-library.dll publish\gsm-library.dll
move build\${{matrix.build_conf}}\bin\gsm-loader.exe publish\gsm-loader.exe
move resources\program_dir\*.* publish\
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Windows
path: |
publish/*
release:
name: release-builds
runs-on: ubuntu-latest
needs: [build]
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- name: Fetch artifacts
uses: actions/[email protected]
- name: Remove old release
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: continuous
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Repackage binaries and allow GitHub to process removed release for few seconds
run: |
cd Windows
zip -r ../goldsrc-monitor-win32.zip *
sleep 20s
- name: Upload new release
uses: softprops/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: goldsrc-monitor*
tag_name: continuous
draft: false
prerelease: true
name: GoldSrc Monitor Continuous Build