Skip to content

Commit c9a71d8

Browse files
committed
improve workflow, add both pods to the release
1 parent 78bf9a2 commit c9a71d8

File tree

2 files changed

+121
-120
lines changed

2 files changed

+121
-120
lines changed
Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,55 @@
11
on:
2-
workflow_dispatch:
3-
inputs:
4-
release_tag:
5-
type: string
6-
required: true
7-
database_type:
8-
type: string
9-
required: true
10-
push:
11-
paths-ignore:
12-
- 'README.md'
13-
branches:
14-
- main
15-
- cloudpod_workflow
2+
workflow_dispatch:
3+
inputs:
4+
release-tag:
5+
type: string
6+
required: true
7+
push:
8+
paths-ignore:
9+
- 'README.md'
10+
branches:
11+
- main
12+
- cloudpod_workflow
1613

1714
permissions:
18-
contents: write
15+
contents: write
1916

2017
name: Create Release
2118
jobs:
22-
build:
23-
uses: ./.github/workflows/setup.yml
24-
secrets: inherit
19+
build:
20+
strategy:
21+
matrix:
22+
database-type: [mysql, mariadb]
23+
uses: ./.github/workflows/setup.yml
24+
secrets: inherit
25+
with:
26+
store-cloudpod: "true"
27+
database-type: ${{ matrix.database-type }}
28+
localstack-version: ${{ inputs.release-tag || 'latest'}}
29+
upload:
30+
needs: build
31+
name: Upload Release Asset
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Download Pod Artifacts
35+
uses: actions/download-artifact@v3
2536
with:
26-
store-cloudpod: "true"
27-
database-type: ${{ inputs.database_type || 'mysql' }}
28-
localstack-version: ${{ inputs.release_tag || 'latest'}}
29-
upload:
30-
needs: build
31-
name: Upload Release Asset
32-
runs-on: ubuntu-latest
33-
steps:
34-
- name: Download Artifact
35-
uses: actions/download-artifact@v3
36-
with:
37-
name: cloudpod
38-
- name: Display structure of downloaded files
39-
run: ls -R
40-
- name: Build project # This would actually build your project, using zip for an example artifact
41-
run: |
42-
echo "Cloudpod Release Version ${{ inputs.release_tag || 'latest'}}" > Release.txt
43-
- name: Create Release
44-
id: create_release
45-
uses: softprops/action-gh-release@v1
46-
with:
47-
tag_name: "v-${{ inputs.release_tag || 'latest'}}"
48-
name: "Cloudpod for LocalStack release ${{ inputs.release_tag || 'latest'}}"
49-
body: "Test Release ${{ inputs.release_tag || 'latest'}} for database ${{ inputs.database_type || 'mysql' }}"
50-
files: |
51-
./release-pod.zip
52-
Release.txt
37+
name: cloudpod
38+
- name: Display structure of downloaded files
39+
run: ls -R
40+
- name: Prepare Release.txt
41+
run: |
42+
echo "Cloud Pod Release for LocalStack Version ${{ inputs.release-tag || 'latest'}}." > Release.txt
43+
echo "Please use the 'release-pod-{database}.zip' you need for your configuration." >> Release.txt
44+
echo "By default LocalStack uses the engine 'mariadb'. If you start LocalStack with 'RDS_MYSQL_DOCKER=1', please use the 'mysql' pod." >> Release.txt
45+
- name: Create Release
46+
id: create_release
47+
uses: softprops/action-gh-release@v1
48+
with:
49+
tag_name: "${{ inputs.release-tag || 'latest'}}"
50+
name: "Cloud Pod for LocalStack Version '${{ inputs.release-tag || 'latest'}}'"
51+
body: "The release features a cloud pod for LocalStack version '${{ inputs.release-tag || 'latest'}}'"
52+
files: |
53+
./release-pod-mysql.zip
54+
./release-pod-mariadb.zip
55+
Release.txt

.github/workflows/setup.yml

Lines changed: 73 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,77 @@
1-
name: Setup LocalStack
1+
name: Setup Sample with LocalStack
22
on:
3-
workflow_call:
4-
inputs:
5-
store-cloudpod:
6-
required: true
7-
type: string
8-
database-type:
9-
required: true
10-
type: string
11-
localstack-version:
12-
required: true
13-
type: string
3+
workflow_call:
4+
inputs:
5+
store-cloudpod:
6+
required: true
7+
type: string
8+
database-type:
9+
required: true
10+
type: string
11+
localstack-version:
12+
required: true
13+
type: string
1414

1515
jobs:
16-
setup-localstack:
17-
name: Setup infrastructure
18-
runs-on: ubuntu-latest
19-
steps:
20-
- name: Checkout
21-
uses: actions/checkout@v3
22-
23-
- name: Setup Python
24-
uses: actions/setup-python@v4
25-
with:
26-
python-version: '3.9'
27-
28-
- name: Setup Nodejs
29-
uses: actions/setup-node@v3
30-
with:
31-
node-version: 16
32-
33-
- name: Install dependencies
34-
run: |
35-
make install
36-
37-
- name: Start LocalStack
38-
env:
39-
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
40-
LOCALSTACK_VOLUME_DIR: ${{ github.workspace }}/ls_test
41-
MYSQL_FEATURE_FLAG: ${{ inputs.database-type }}
42-
run: |
43-
mkdir ls_test
44-
ls -la ls_test
45-
docker pull localstack/localstack-pro:${{ inputs.localstack-version }}
46-
# Start LocalStack in the background
47-
if [ "mysql" == ${MYSQL_FEATURE_FLAG} ]; then
48-
LS_LOG=trace RDS_MYSQL_DOCKER=1 localstack start -d
49-
else
50-
LS_LOG=trace localstack start -d
51-
fi
52-
# Wait 30 seconds for the LocalStack container to become ready before timing out
53-
echo "Waiting for LocalStack startup..."
54-
localstack wait -t 15
55-
echo "Startup complete"
56-
57-
- name: Deploy the application
58-
env:
59-
AWS_ACCESS_KEY_ID: test
60-
AWS_SECRET_ACCESS_KEY: test
61-
AWS_DEFAULT_REGION: us-east-1
62-
run: |
63-
make build
64-
make bootstrap
65-
make deploy
66-
67-
- name: Store Pod
68-
if: ${{ inputs.store-cloudpod == 'true' }}
69-
run: |
70-
localstack pod save file://release-pod.zip
71-
- name: Upload Pod as Artifact
72-
if: ${{ inputs.store-cloudpod == 'true' }}
73-
uses: actions/upload-artifact@v3
74-
with:
75-
name: cloudpod
76-
path: release-pod.zip
77-
retention-days: 1
16+
setup-localstack:
17+
name: Setup infrastructure
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
7822

79-
23+
- name: Setup Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: '3.9'
27+
28+
- name: Setup Nodejs
29+
uses: actions/setup-node@v3
30+
with:
31+
node-version: 16
32+
33+
- name: Install dependencies
34+
run: |
35+
make install
36+
37+
- name: Start LocalStack
38+
env:
39+
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
40+
LOCALSTACK_VOLUME_DIR: ${{ github.workspace }}/ls_test
41+
MYSQL_FEATURE_FLAG: ${{ inputs.database-type }}
42+
run: |
43+
mkdir ls_test
44+
ls -la ls_test
45+
docker pull localstack/localstack-pro:${{ inputs.localstack-version }}
46+
# Start LocalStack in the background
47+
if [ "mysql" == ${MYSQL_FEATURE_FLAG} ]; then
48+
LS_LOG=trace RDS_MYSQL_DOCKER=1 localstack start -d
49+
else
50+
LS_LOG=trace localstack start -d
51+
fi
52+
# Wait 30 seconds for the LocalStack container to become ready before timing out
53+
echo "Waiting for LocalStack startup..."
54+
localstack wait -t 15
55+
echo "Startup complete"
56+
57+
- name: Deploy the application
58+
env:
59+
AWS_ACCESS_KEY_ID: test
60+
AWS_SECRET_ACCESS_KEY: test
61+
AWS_DEFAULT_REGION: us-east-1
62+
run: |
63+
make build
64+
make bootstrap
65+
make deploy
66+
67+
- name: Store Pod
68+
if: ${{ inputs.store-cloudpod == 'true' }}
69+
run: |
70+
localstack pod save file://release-pod-${{ inputs.database-type }}.zip
71+
- name: Upload Pod as Artifact
72+
if: ${{ inputs.store-cloudpod == 'true' }}
73+
uses: actions/upload-artifact@v3
74+
with:
75+
name: cloudpod
76+
path: release-pod-${{ inputs.database-type }}.zip
77+
retention-days: 1

0 commit comments

Comments
 (0)