-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e6d247
commit 67802d8
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# This automation archives selected repos with LFS objects and saves it to a specific tag | ||
# Contact SIG-Build for any issues or looking to make changes | ||
|
||
name: Archive repos | ||
|
||
on: | ||
# Allows you to run this workflow manually from the Actions tag | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
Publish: | ||
name: Publish ${{ matrix.repository }} for ${{ matrix.branch }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
owner: [o3de] | ||
repository: [o3de, o3de-extras] | ||
branch: [development, stabilization/2409] | ||
|
||
steps: | ||
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ matrix.owner }}/${{ matrix.repository }} | ||
ref: ${{ matrix.branch }} | ||
fetch-depth: 0 | ||
|
||
- name: Git LFS pull | ||
run: | | ||
git lfs install | ||
git lfs fetch | ||
- name: Get repo vars | ||
id: vars | ||
run: | | ||
VERSION=$(echo "${{ matrix.branch }}" | tr '/' '-') | ||
echo ::set-output name=latest_log::$(git log --pretty=short HEAD^..HEAD) | ||
echo ::set-output name=archive_file::${{ matrix.repository }}-$VERSION | ||
- name: Archive repo as compressed files | ||
run: | | ||
git archive -o ${{ steps.vars.outputs.archive_file }}.tar.gz HEAD | ||
- name: Split archive files if over limit | ||
run: | # MAXSIZE = 2GB | ||
MAXSIZE=2000000000 | ||
ARCFILE=${{ steps.vars.outputs.archive_file }} | ||
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 | ||
rm -f temp-archive.* | ||
fi | ||
# Creates a release tag based on inputs | ||
- name: Create Release | ||
uses: ncipollo/[email protected] | ||
with: | ||
replacesArtifacts: true | ||
removeArtifacts: true | ||
allowUpdates: true | ||
name: ${{ steps.vars.outputs.archive_file }} | ||
tag: ${{ steps.vars.outputs.archive_file }} | ||
body: | | ||
${{ steps.vars.outputs.latest_log }} | ||
artifacts: ${{ steps.vars.outputs.archive_file }}.tar* |