Attach Release Artifacts #24
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Attach Release Artifacts" | |
on: | |
release: | |
types: [published] | |
jobs: | |
attach-release-artifacts: | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Get Branch | |
shell: bash | |
run: | | |
releaseBranch=${{ github.event.release.target_commitish }} | |
echo "Found branch ${releaseBranch}" | |
echo "tagged_branch=${releaseBranch}" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ env.tagged_branch }} | |
- name: Download required assemblies | |
id: download-assemblies | |
uses: KSP-RO/BuildTools/download-assemblies@master | |
with: | |
KSP_ZIP_PASSWORD: ${{ secrets.KSP_ZIP_PASSWORD }} | |
# Install .NET SDKs | |
- name: Setup .NET Core 3.1 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1.x | |
- name: Setup .NET 5.0 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.x | |
- name: Update AssemblyInfo | |
uses: KSP-RO/BuildTools/update-assembly-info@master | |
with: | |
path: ${GITHUB_WORKSPACE}/src/RealAntennasProject/Properties/AssemblyInfo.cs | |
tag: ${{ github.event.release.tag_name }} | |
- name: Build mod solution | |
run: | | |
msbuild ${GITHUB_WORKSPACE}/src/RealAntennasProject.sln /t:build /restore /p:RestorePackagesConfig=true /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" | |
- name: Remove excess DLLs | |
uses: KSP-RO/BuildTools/remove-excess-dlls@master | |
with: | |
path: ${GITHUB_WORKSPACE}/GameData/ | |
- name: Update version file | |
uses: KSP-RO/BuildTools/update-version-file@master | |
with: | |
tag: ${{ github.event.release.tag_name }} | |
path: ${GITHUB_WORKSPACE}/GameData/RealAntennas/RealAntennas.version | |
- name: Update changelog file | |
uses: KSP-RO/BuildTools/process-changelog@master | |
with: | |
tag: ${{ github.event.release.tag_name }} | |
body: ${{ github.event.release.body }} | |
path: ${GITHUB_WORKSPACE}/GameData/RealAntennas/changelog.cfg | |
- name: Assemble release | |
id: assemble-release | |
run: | | |
RELEASE_DIR="${RUNNER_TEMP}/release" | |
echo "Release dir: ${RELEASE_DIR}" | |
echo "Release zip: ${RELEASE_DIR}/RealAntennas-${{ github.event.release.tag_name }}.zip" | |
mkdir -v "${RELEASE_DIR}" | |
echo "::set-output name=release-dir::${RELEASE_DIR}" | |
cp -v -R "${GITHUB_WORKSPACE}/GameData" "${RELEASE_DIR}" | |
cd ${RELEASE_DIR} | |
zip -r RealAntennas-${{ github.event.release.tag_name }}.zip GameData/RealAntennas | |
- name: Upload package to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ steps.assemble-release.outputs.release-dir }}/RealAntennas-${{ github.event.release.tag_name }}.zip | |
asset_name: RealAntennas-${{ github.event.release.tag_name }}.zip | |
asset_content_type: application/zip | |
- name: Setup git config | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
- name: Commit changes | |
shell: bash | |
env: | |
TAG_STRING: ${{ github.event.release.tag_name }} | |
run: | | |
RELEASEBRANCH=${{ env.tagged_branch }} | |
git add "${GITHUB_WORKSPACE}/GameData/RealAntennas/RealAntennas.version" | |
git add "${GITHUB_WORKSPACE}/GameData/RealAntennas/changelog.cfg" | |
git commit -m "Update version to $TAG_STRING" | |
git push origin $RELEASEBRANCH | |
git tag $TAG_STRING $RELEASEBRANCH --force | |
git push origin $TAG_STRING --force |