Skip to content

Tag internal build #133

Tag internal build

Tag internal build #133

Workflow file for this run

# This workflow is triggered on a schedule and on demand. It updates the version number and triggers the deploy jobs.
name: Tag internal build
on:
workflow_dispatch:
inputs:
suffix:
description: 'Suffix to add to the version number (e.g. suffix "testing" will create a version like "0.3.0-internal-testing")'
required: true
default: "fancy-new-feature"
schedule:
- cron: "0 2 * * *"
env:
CARGO_TERM_COLOR: always
BOT_NAME: "Moose Jobs"
BOT_EMAIL: ${{ secrets.MOOSE_JOBS_EMAIL }}
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y tree libasound2-dev libglib2.0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libcairo-dev libgtk2.0-dev libsoup2.4-dev libgtk-3-dev libwebkit2gtk-4.0-dev xorg-dev ninja-build libxcb-render0-dev clang nodejs
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Add wasm32-wasi target
run: rustup target add --toolchain stable wasm32-wasi
- name: Add wasm32-unknown-unknown target
run: rustup target add --toolchain stable wasm32-unknown-unknown
- name: Rust cache
uses: Leafwing-Studios/cargo-cache@v1.1.0
- name: Extract tag from input
if: github.event_name == 'workflow_dispatch'
run: |
echo "version_suffix=internal-${{ github.event.inputs.suffix }}" >> $GITHUB_ENV
- name: Extract tag from input
if: github.event_name == 'schedule'
run: |
date_suffix=$(date +%Y-%m-%d)
echo "version_suffix=nightly-${date_suffix}" >> $GITHUB_ENV
- name: Extract base branch and revert flag
if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/heads/')
run: |
echo "base_branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "revert=false" >> $GITHUB_ENV
- name: Extract base branch and revert flag
if: github.event_name == 'schedule'
run: |
echo "base_branch=main" >> $GITHUB_ENV
echo "revert=true" >> $GITHUB_ENV
- name: Update version and tag
id: tag
run: |
version_majminpat=$(cargo cf --version | sed -E -e 's/campfire ([0-9]+\.[0-9]+\.[0-9]+).*$/\1/')
version="${version_majminpat}-${{ env.version_suffix }}"
tag="v${version}"
cargo cf release update-version ${version}
git config --global user.name "${{ env.BOT_NAME }}"
git config --global user.email "${{ env.BOT_EMAIL }}"
git commit -a -m "Update version to ${version}"
git tag ${tag}
git push origin ${tag}
echo tag=${tag} >> $GITHUB_OUTPUT
- name: Trigger the release job
uses: actions/github-script@v6
with:
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'release-version.yml',
ref: '${{ steps.tag.outputs.tag }}',
inputs: {
packages_merge_base: '${{ env.base_branch }}',
packages_merge_revert: '${{ env.revert }}',
}
})