-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (60 loc) · 2.02 KB
/
create_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Create release
on:
push:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: "0"
- name: Create artifacts files
run: |
docker compose -f docker/build-docker-compose.yml build
docker compose -f docker/build-docker-compose.yml up
docker compose -f docker/build-docker-compose.yml down -v
- name: Package build output
run: |
BUILD_DIR=${GITHUB_WORKSPACE}/artifacts/contracts
APP_VER_SHORT=$(git describe --tags)
ARCHIVE="artifacts_""$APP_VER_SHORT"".zip"
echo "ARCHIVE=${ARCHIVE}" >> $GITHUB_ENV
sudo chown -R $USER: ${BUILD_DIR}
chmod -R 755 ${BUILD_DIR}
ls -al ${BUILD_DIR}
zip -r -j ${ARCHIVE} ${BUILD_DIR}
- name: Save artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARCHIVE }}
path: ${{ env.ARCHIVE }}
if-no-files-found: error
release:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
# https://docs.github.com/en/free-pro-team@latest/actions/guides/storing-workflow-data-as-artifacts#downloading-or-deleting-artifacts
# A directory for each artifact is created using its name
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
with:
path: ${GITHUB_WORKSPACE}
- name: Display structure of downloaded files
run: ls -R
working-directory: ${GITHUB_WORKSPACE}
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create --draft --notes="Release draft from Github Actions" vNext
sleep 10
for i in $(find ${GITHUB_WORKSPACE} -name '*.zip' -type f); do
gh release upload vNext ${i}
done