Skip to content

Commit 4e1da5e

Browse files
author
Sean Sundberg
authored
Moves asset upload logic to after release is published (#109)
1 parent 858b7b6 commit 4e1da5e

File tree

3 files changed

+76
-51
lines changed

3 files changed

+76
-51
lines changed

.github/workflows/notify.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
release:
55
types:
66
- published
7-
- released
87

98
jobs:
109
notify:
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Publish assets
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
release-installer:
10+
runs-on: ubuntu-latest
11+
12+
env:
13+
DIST_DIR: ./dist
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
ref: ${{ github.event.release.tag_name }}
20+
21+
- name: Build tile installer
22+
run: |
23+
mkdir -p ${{ env.DIST_DIR }}
24+
cat ./.tile/scripts/master.sh | sed "s/VERSION=latest/VERSION=${{ github.event.release.tag_name }}/g" > ${{ env.DIST_DIR }}/create-catalog-offering.sh
25+
chmod +x ${{ env.DIST_DIR }}/create-catalog-offering.sh
26+
27+
- name: Upload tile installer
28+
uses: actions/upload-release-asset@v1
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
with:
32+
upload_url: ${{ github.event.release.upload_url }}
33+
asset_path: ./dist/create-catalog-offering.sh
34+
asset_name: create-catalog-offering.sh
35+
asset_content_type: application/octet-stream
36+
37+
release-offerings:
38+
runs-on: ubuntu-latest
39+
40+
env:
41+
DIST_DIR: ./dist
42+
43+
strategy:
44+
matrix:
45+
offering:
46+
- cloudnative-toolkit
47+
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v2
51+
with:
52+
ref: ${{ github.event.release.tag_name }}
53+
54+
- name: Build offering
55+
run: |
56+
./.tile/scripts/build.sh ${{ env.DIST_DIR }} ${{ matrix.offering }} ${{ github.event.release.tag_name }}
57+
58+
- name: Upload offering json
59+
uses: actions/upload-release-asset@v1
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
upload_url: ${{ github.event.release.upload_url }}
64+
asset_path: ./dist/offering-${{ matrix.offering }}.json
65+
asset_name: offering-${{ matrix.offering }}.json
66+
asset_content_type: application/json
67+
68+
- name: Upload offering tar
69+
uses: actions/upload-release-asset@v1
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
with:
73+
upload_url: ${{ github.event.release.upload_url }}
74+
asset_path: ./dist/${{ matrix.offering }}.tar.gz
75+
asset_name: ${{ matrix.offering }}.tar.gz
76+
asset_content_type: application/gzip

.github/workflows/release.yaml

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ jobs:
1111
release:
1212
runs-on: ubuntu-latest
1313

14-
env:
15-
DIST_DIR: ./dist
16-
1714
# Steps represent a sequence of tasks that will be executed as part of the job
1815
steps:
1916
# Drafts your next Release notes as Pull Requests are merged into "master"
@@ -24,50 +21,3 @@ jobs:
2421
config-name: release-drafter.yaml
2522
env:
2623
GITHUB_TOKEN: ${{ secrets.TOKEN }}
27-
28-
- name: Checkout
29-
uses: actions/checkout@v2
30-
31-
- name: Build tile installer
32-
run: |
33-
mkdir -p ${{ env.DIST_DIR }}
34-
cat ./.tile/scripts/master.sh | sed "s/VERSION=latest/VERSION=${{ steps.create-release.outputs.tag_name }}/g" > ${{ env.DIST_DIR }}/create-catalog-offering.sh
35-
chmod +x ${{ env.DIST_DIR }}/create-catalog-offering.sh
36-
37-
- name: Upload tile installer
38-
uses: actions/upload-release-asset@v1
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
with:
42-
upload_url: ${{ steps.create-release.outputs.upload_url }}
43-
asset_path: ./dist/create-catalog-offering.sh
44-
asset_name: create-catalog-offering.sh
45-
asset_content_type: application/octet-stream
46-
47-
- name: Build offering
48-
run: |
49-
./.tile/scripts/build.sh ${{ env.DIST_DIR }} ${{ env.OFFERING }} ${{ steps.create-release.outputs.tag_name }}
50-
env:
51-
OFFERING: cloudnative-toolkit
52-
53-
- name: Upload offering json
54-
uses: actions/upload-release-asset@v1
55-
env:
56-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57-
OFFERING: cloudnative-toolkit
58-
with:
59-
upload_url: ${{ steps.create-release.outputs.upload_url }}
60-
asset_path: ./dist/offering-${{ env.OFFERING }}.json
61-
asset_name: offering-${{ env.OFFERING }}.json
62-
asset_content_type: application/json
63-
64-
- name: Upload offering tar
65-
uses: actions/upload-release-asset@v1
66-
env:
67-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68-
OFFERING: cloudnative-toolkit
69-
with:
70-
upload_url: ${{ steps.create-release.outputs.upload_url }}
71-
asset_path: ./dist/$${ env.OFFERING }}.tar.gz
72-
asset_name: ${{ env.OFFERING }}.tar.gz
73-
asset_content_type: application/gzip

0 commit comments

Comments
 (0)