Skip to content

Commit 2f40b20

Browse files
committed
Updated workflow to upload artifacts
1 parent 519716e commit 2f40b20

1 file changed

Lines changed: 34 additions & 45 deletions

File tree

Lines changed: 34 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,53 @@
1-
name: Create and Upload Release
1+
name: Release
22

33
on:
44
push:
55
tags:
6-
- '*'
6+
- 'v*.*.*'
77

88
jobs:
99
build:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v4
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
1515
with:
16-
submodules: true
16+
submodules: true # Include submodules
17+
fetch-depth: 0
1718

18-
- name: Set up Git
19+
- name: Create tar.gz archive
1920
run: |
20-
git config --global user.name "GitHub Actions"
21-
git config --global user.email "actions@github.com"
21+
mkdir -p release
22+
git archive --format=tar.gz --prefix=cpp-oasvalidator-${GITHUB_REF#refs/tags/}/ HEAD > release/cpp-oasvalidator-${GITHUB_REF#refs/tags/}.tar.gz
23+
cd release
24+
tar -xzf cpp-oasvalidator-${GITHUB_REF#refs/tags/}.tar.gz
25+
git submodule foreach --recursive 'git archive --format=tar.gz --prefix=$path/ HEAD > ../$path.tar.gz'
26+
for f in *.tar.gz; do tar -xzf "$f"; done
27+
rm *.tar.gz
28+
cd ..
29+
tar -czf cpp-oasvalidator-${GITHUB_REF#refs/tags/}.tar.gz -C release .
2230
23-
- name: Create release archives
31+
- name: Create zip archive
2432
run: |
25-
TAG=${GITHUB_REF#refs/tags/}
26-
# Create tar.gz archive
27-
git archive --format=tar.gz --prefix=cpp-oasvalidator-${TAG}/ -o cpp-oasvalidator-${TAG}.tar.gz ${TAG}
28-
# Create zip archive
29-
git archive --format=zip --prefix=cpp-oasvalidator-${TAG}/ -o cpp-oasvalidator-${TAG}.zip ${TAG}
30-
31-
# Include submodules
32-
TEMP_DIR=$(mktemp -d)
33-
git clone --recursive . $TEMP_DIR/cpp-oasvalidator-${TAG}
34-
35-
# Add submodule content to tar.gz archive
36-
tar -czf cpp-oasvalidator-${TAG}-with-submodules.tar.gz -C $TEMP_DIR cpp-oasvalidator-${TAG}
37-
mv cpp-oasvalidator-${TAG}-with-submodules.tar.gz cpp-oasvalidator-${TAG}.tar.gz
38-
39-
# Add submodule content to zip archive
40-
(cd $TEMP_DIR && zip -r cpp-oasvalidator-${TAG}-with-submodules.zip cpp-oasvalidator-${TAG})
41-
mv $TEMP_DIR/cpp-oasvalidator-${TAG}-with-submodules.zip cpp-oasvalidator-${TAG}.zip
42-
43-
# Clean up
44-
rm -rf $TEMP_DIR
33+
mkdir -p release
34+
git archive --format=zip --prefix=cpp-oasvalidator-${GITHUB_REF#refs/tags/}/ HEAD > release/cpp-oasvalidator-${GITHUB_REF#refs/tags/}.zip
35+
cd release
36+
unzip cpp-oasvalidator-${GITHUB_REF#refs/tags/}.zip
37+
git submodule foreach --recursive 'git archive --format=zip --prefix=$path/ HEAD > ../$path.zip'
38+
for f in *.zip; do unzip "$f"; done
39+
rm *.zip
40+
cd ..
41+
zip -r cpp-oasvalidator-${GITHUB_REF#refs/tags/}.zip release
4542
46-
- name: Upload tar.gz to release
47-
uses: svenstaro/upload-release-action@v2
43+
- name: Upload Release Assets
44+
uses: actions/upload-artifact@v2
4845
with:
49-
repo_token: ${{ secrets.GITHUB_TOKEN }}
50-
file: cpp-oasvalidator-${TAG}.tar.gz
51-
asset_name: cpp-oasvalidator-${TAG}.tar.gz
52-
tag: ${{ github.ref }}
53-
overwrite: true
54-
body: "Release ${TAG}"
46+
name: release-asset-tar
47+
path: cpp-oasvalidator-${GITHUB_REF#refs/tags/}.tar.gz
5548

56-
- name: Upload zip to release
57-
uses: svenstaro/upload-release-action@v2
49+
- name: Upload Release Assets
50+
uses: actions/upload-artifact@v2
5851
with:
59-
repo_token: ${{ secrets.GITHUB_TOKEN }}
60-
file: cpp-oasvalidator-${TAG}.zip
61-
asset_name: cpp-oasvalidator-${TAG}.zip
62-
tag: ${{ github.ref }}
63-
overwrite: true
64-
body: "Release ${TAG}"
52+
name: release-asset-zip
53+
path: cpp-oasvalidator-${GITHUB_REF#refs/tags/}.zip

0 commit comments

Comments
 (0)