Merging from develop #178
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
### | |
### Copyright (c) 2023 Carbon Community | |
### All rights reserved | |
### | |
name: Production Build | |
concurrency: build-1-production | |
on: | |
push: | |
branches: | |
- production | |
workflow_dispatch: | |
jobs: | |
bootstrap: | |
name: 🥾 Bootstrap | |
runs-on: ubuntu-latest | |
outputs: | |
date: ${{ steps.step1.outputs.date }} | |
clock: ${{ steps.step1.outputs.clock }} | |
tag: ${{ steps.step1.outputs.tag }} | |
ref: ${{ steps.step1.outputs.ref }} | |
wipe: ${{ steps.step1.outputs.wipe }} | |
version: ${{ steps.step1.outputs.version }} | |
steps: | |
#- name: Log environment | |
# uses: crazy-max/ghaction-dump-context@v1 | |
- name: 🔗 Checkout source code from github | |
uses: actions/checkout@v3 | |
with: | |
ref: production | |
- name: 📅 Prepare the environment | |
id: step1 | |
run: | | |
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
echo "clock=$(date +'%H:%M:%S')" >> $GITHUB_OUTPUT | |
echo "tag=$(date +'%Yd%j')" >> $GITHUB_OUTPUT | |
echo "ref=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
echo "wipe=$( [ $(date +%u) -eq 4 ] && [ $(date +%d) -le 7 ] && echo true || echo false )" >> $GITHUB_OUTPUT | |
echo "version=$(date +'1.%Y.%q%j.%M%S')" >> $GITHUB_OUTPUT | |
# BUILD LINUX ---------------------------------------------------------------- | |
build-linux: | |
name: 🐧 Linux | |
needs: bootstrap | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
outputs: | |
wipe: ${{ needs.bootstrap.outputs.wipe }} | |
artifact: build-production-${{ needs.bootstrap.outputs.ref }}-linux | |
build_info: Built at ${{ needs.bootstrap.outputs.date }} ${{ needs.bootstrap.outputs.clock }} based on commit ${{ needs.bootstrap.outputs.ref }}. | |
steps: | |
- name: 🔗 Checkout source code from github | |
uses: actions/checkout@v3 | |
with: | |
ref: production | |
token: ${{ secrets.PAT_ALL_REPO }} | |
submodules: recursive | |
- name: 🛤️ Setup the dotnet build environment | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 7.0.x | |
- name: 🔨 Setup the Carbon build environment | |
shell: bash | |
run: | | |
${GITHUB_WORKSPACE}/Tools/Build/linux/bootstrap.sh | |
- name: 🐧 Built Carbon on Linux | |
shell: bash | |
run: | | |
export VERSION=${{ needs.bootstrap.outputs.version }} | |
${GITHUB_WORKSPACE}/Tools/Build/linux/build.sh ReleaseUnix "" "production_build" | |
${GITHUB_WORKSPACE}/Tools/Build/linux/build.sh MinimalUnix "" "production_build" | |
- name: ⬆️ Upload the artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-production-linux | |
path: | | |
Release/Carbon.Linux.Release.tar.gz | |
Release/Carbon.Linux.Release.info | |
Release/Carbon.Linux.Minimal.tar.gz | |
Release/Carbon.Linux.Minimal.info | |
# BUILD WINDOWS -------------------------------------------------------------- | |
build-windows: | |
name: 💻 Windows | |
needs: bootstrap | |
runs-on: windows-latest | |
continue-on-error: false | |
steps: | |
- name: 🔗 Checkout source code from github | |
uses: actions/checkout@v3 | |
with: | |
ref: production | |
token: ${{ secrets.PAT_ALL_REPO }} | |
submodules: recursive | |
- name: 🛤️ Setup the dotnet build environment | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 7.0.x | |
- name: 🔨 Setup the Carbon build environment | |
shell: cmd | |
run: | | |
%GITHUB_WORKSPACE%\Tools\Build\win\bootstrap.bat | |
- name: 🔨 Built Carbon on Windows | |
shell: cmd | |
run: | | |
set VERSION=${{ needs.bootstrap.outputs.version }} | |
call %GITHUB_WORKSPACE%\Tools\Build\win\build.bat Release . production_build | |
call %GITHUB_WORKSPACE%\Tools\Build\win\build.bat Minimal . production_build | |
- name: ⬆️ Upload the artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-production-windows | |
path: | | |
Release/Carbon.Windows.Release.zip | |
Release/Carbon.Windows.Release.info | |
Release/Carbon.Windows.Minimal.zip | |
Release/Carbon.Windows.Minimal.info | |
- name: 🔨 Upload NuGet package | |
shell: cmd | |
run: | | |
%GITHUB_WORKSPACE%\Tools\Build\win\publish_nuget.bat ${{ secrets.NUGET_API }} ${{ needs.bootstrap.outputs.version }} | |
# RELEASE -------------------------------------------------------------------- | |
release-on-schedule: | |
name: 💾 Production Release | |
needs: [ "bootstrap", "build-linux", "build-windows" ] | |
runs-on: ubuntu-latest | |
if: ${{ (github.event_name == 'push') || (github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule' && needs.build-linux.outputs.wipe == 'true') }} | |
steps: | |
- name: 🗑️ Delete existing release tag | |
uses: dev-drprasad/delete-tag-and-release@92d94d77429cb0436597047a92369526a5824f50 | |
with: | |
delete_release: true | |
tag_name: production_build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: 💤 Sleep for 5 seconds | |
run: sleep 5s | |
shell: bash | |
- name: ⬇️ Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: Release/ | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: Release | |
- name: 🏷️ Update release tag | |
uses: softprops/action-gh-release@d4e8205d7e959a9107da6396278b2f1f07af0f9b | |
with: | |
draft: false | |
prerelease: false | |
tag_name: production_build | |
name: 'Production Build — v${{ needs.bootstrap.outputs.version }}' | |
body: | | |
This is a release build of Carbon based on the `production` branch. | |
This build is targeted at the general public. | |
### How to install | |
1. Download the `Carbon.[Windows|Linux].Release` archive from the attachments below. | |
2. Unzip the archive to the root of your Rust Dedicated Server. | |
3. Restart the server and enjoy. | |
${{ needs.build-linux.outputs.build_info }} | |
files: | | |
Release/build-production-linux/Carbon.Linux.Release.info | |
Release/build-production-linux/Carbon.Linux.Release.tar.gz | |
Release/build-production-windows/Carbon.Windows.Release.info | |
Release/build-production-windows/Carbon.Windows.Release.zip | |
Release/build-production-linux/Carbon.Linux.Minimal.info | |
Release/build-production-linux/Carbon.Linux.Minimal.tar.gz | |
Release/build-production-windows/Carbon.Windows.Minimal.info | |
Release/build-production-windows/Carbon.Windows.Minimal.zip |