Releasing o3de for 2409.1 #18
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
# This automation performs release tagging and artifact uploads of the LFS objects | |
# Contact SIG-Build for any issues or looking to make changes | |
name: Publish new release | |
on: | |
# Allows you to run this workflow manually from the Actions tag | |
workflow_dispatch: | |
inputs: | |
repository: | |
description: 'The repo to target for release' | |
required: true | |
type: choice | |
default: o3de | |
options: | |
- o3de | |
- o3de-atom-sampleviewer | |
- o3de-extras | |
- o3de-multiplayersample | |
- o3de-netsoaktest | |
release_tag: | |
description: 'The release tag' | |
required: true | |
type: string | |
release_notes_url: | |
description: 'The release notes url' | |
required: false | |
type: string | |
draft_release: | |
description: 'Stage release as draft. If unchecked, publish immediately' | |
default: true | |
required: true | |
type: boolean | |
run-name: Releasing ${{ inputs.repository }} for ${{ inputs.release_tag }} | |
jobs: | |
Publish: | |
name: Deploy | |
runs-on: ubuntu-latest | |
environment: ${{ github.ref_name }} # Check environment against branch | |
permissions: | |
contents: write | |
steps: | |
# Checkout the repository under $GITHUB_WORKSPACE, so the job can access it | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.repository_owner }}/${{ inputs.repository }} | |
ref: main | |
fetch-depth: 0 | |
- name: Git LFS pull | |
run: | | |
git lfs install | |
git lfs fetch | |
- name: Get repo vars | |
id: vars | |
run: | | |
echo ::set-output name=latest_tag::$(git describe --tags `git rev-list --tags --max-count=1`) | |
echo ::set-output name=latest_main_sha::$(git log -n 1 --pretty=format:"%H" origin/main) | |
echo ::set-output name=archive_file::${{ inputs.repository }}-${{ inputs.release_tag }}-lfs | |
- name: Archive repo as compressed files | |
run: | | |
git archive -o ${{ steps.vars.outputs.archive_file }}.zip HEAD | |
git archive -o ${{ steps.vars.outputs.archive_file }}.tar.gz HEAD | |
- name: Split archive files if over limit | |
run: | # MAXSIZE = 2GB | |
MAXSIZE=2000000000 | |
MAXSIZE_ZIP=2g | |
ARCFILE=${{ steps.vars.outputs.archive_file }} | |
if [ $(stat -c '%s' $ARCFILE.zip) -ge $MAXSIZE ]; then | |
mv $ARCFILE.zip temp-archive.zip && zip temp-archive.zip -s $MAXSIZE_ZIP --out $ARCFILE.zip | |
fi | |
if [ $(stat -c '%s' $ARCFILE.tar.gz) -ge $MAXSIZE ]; then | |
mv $ARCFILE.tar.gz temp-archive.tar.gz && split -b $MAXSIZE temp-archive.tar.gz $ARCFILE.tar.gz.part | |
fi | |
rm -f temp-archive.* | |
# Creates a release tag based on inputs | |
- name: Create Release | |
id: create_release | |
uses: ncipollo/[email protected] | |
with: | |
token: ${{ secrets.RELEASE_TOKEN }} # The RELEASE_TOKEN var is provided by the repo's Github environment secret to do cross repo actions | |
repo: ${{ inputs.repository }} | |
owner: ${{ github.repository_owner }} | |
name: ${{ inputs.release_tag }} | |
tag: ${{ inputs.release_tag }} | |
commit: ${{ steps.vars.outputs.latest_main_sha }} | |
body: | | |
## Release Notes | |
${{ inputs.release_notes_url }} | |
**Full Changelog**: https://github.com/${{ github.repository_owner }}/${{ inputs.repository }}/compare/${{ steps.vars.outputs.latest_tag }}...${{ inputs.release_tag }} | |
draft: ${{ inputs.draft_release }} | |
prerelease: false | |
artifacts: "${{ steps.vars.outputs.archive_file }}.*" |