-
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.
Updated workflow to upload artifacts
- Loading branch information
Showing
1 changed file
with
36 additions
and
55 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 |
---|---|---|
@@ -1,72 +1,53 @@ | ||
name: Create and Upload Release | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
submodules: true # Include submodules | ||
fetch-depth: 0 | ||
|
||
- name: Set up Git | ||
- name: Create tar.gz archive | ||
run: | | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
- name: Create release archives | ||
run: | | ||
TAG=${GITHUB_REF#refs/tags/} | ||
TAR_FILENAME=cpp-oasvalidator-${TAG}.tar.gz | ||
ZIP_FILENAME=cpp-oasvalidator-${TAG}.zip | ||
# Create tar.gz archive | ||
git archive --format=tar.gz --prefix=cpp-oasvalidator-${TAG}/ -o $TAR_FILENAME ${TAG} | ||
# Create zip archive | ||
git archive --format=zip --prefix=cpp-oasvalidator-${TAG}/ -o $ZIP_FILENAME ${TAG} | ||
# Include submodules | ||
TEMP_DIR=$(mktemp -d) | ||
git clone --recursive . $TEMP_DIR/cpp-oasvalidator-${TAG} | ||
# Add submodule content to tar.gz archive | ||
tar -czf $TEMP_DIR/cpp-oasvalidator-${TAG}-with-submodules.tar.gz -C $TEMP_DIR cpp-oasvalidator-${TAG} | ||
mv $TEMP_DIR/cpp-oasvalidator-${TAG}-with-submodules.tar.gz $TAR_FILENAME | ||
# Add submodule content to zip archive | ||
(cd $TEMP_DIR && zip -r cpp-oasvalidator-${TAG}-with-submodules.zip cpp-oasvalidator-${TAG}) | ||
mv $TEMP_DIR/cpp-oasvalidator-${TAG}-with-submodules.zip $ZIP_FILENAME | ||
# Clean up | ||
rm -rf $TEMP_DIR | ||
- name: List created files for debugging | ||
mkdir -p release | ||
git archive --format=tar.gz --prefix=cpp-oasvalidator-${GITHUB_REF#refs/tags/}/ HEAD > release/cpp-oasvalidator-${GITHUB_REF#refs/tags/}.tar.gz | ||
cd release | ||
tar -xzf cpp-oasvalidator-${GITHUB_REF#refs/tags/}.tar.gz | ||
git submodule foreach --recursive 'git archive --format=tar.gz --prefix=$path/ HEAD > ../$path.tar.gz' | ||
for f in *.tar.gz; do tar -xzf "$f"; done | ||
rm *.tar.gz | ||
cd .. | ||
tar -czf cpp-oasvalidator-${GITHUB_REF#refs/tags/}.tar.gz -C release . | ||
- name: Create zip archive | ||
run: | | ||
ls -alh | ||
ls -alh $TAR_FILENAME | ||
ls -alh $ZIP_FILENAME | ||
- name: Upload tar.gz to release | ||
uses: svenstaro/upload-release-action@v2 | ||
mkdir -p release | ||
git archive --format=zip --prefix=cpp-oasvalidator-${GITHUB_REF#refs/tags/}/ HEAD > release/cpp-oasvalidator-${GITHUB_REF#refs/tags/}.zip | ||
cd release | ||
unzip cpp-oasvalidator-${GITHUB_REF#refs/tags/}.zip | ||
git submodule foreach --recursive 'git archive --format=zip --prefix=$path/ HEAD > ../$path.zip' | ||
for f in *.zip; do unzip "$f"; done | ||
rm *.zip | ||
cd .. | ||
zip -r cpp-oasvalidator-${GITHUB_REF#refs/tags/}.zip release | ||
- name: Upload Release Assets | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
repo_token: ${{ secrets.MY_PAT }} | ||
file: ${{ steps.build.outputs.TAR_FILENAME }} | ||
asset_name: ${{ steps.build.outputs.TAR_FILENAME }} | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
body: "Release ${TAG}" | ||
name: release-asset-tar | ||
path: cpp-oasvalidator-${GITHUB_REF#refs/tags/}.tar.gz | ||
|
||
- name: Upload zip to release | ||
uses: svenstaro/upload-release-action@v2 | ||
- name: Upload Release Assets | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
repo_token: ${{ secrets.MY_PAT }} | ||
file: ${{ steps.build.outputs.ZIP_FILENAME }} | ||
asset_name: ${{ steps.build.outputs.ZIP_FILENAME }} | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
body: "Release ${TAG}" | ||
name: release-asset-zip | ||
path: cpp-oasvalidator-${GITHUB_REF#refs/tags/}.zip |