Skip to content

Commit 8563191

Browse files
authored
refactor workflows after restructuring (#29)
1 parent dd744f4 commit 8563191

3 files changed

Lines changed: 81 additions & 111 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Generate OpenAPI spec
2+
description: Checks out localstack-pro, installs dependencies, and runs update-aws-spec.py.
3+
4+
inputs:
5+
pro-ref:
6+
description: Ref to check out in localstack-pro. Leave empty to use the default branch.
7+
required: false
8+
default: ""
9+
pro-token:
10+
description: Token used to check out localstack-pro.
11+
required: true
12+
fallback-to-main:
13+
description: If "true", fall back to the default branch when the specified ref cannot be checked out.
14+
required: false
15+
default: "false"
16+
latest:
17+
description: If "true", pass --latest to update-aws-spec.py.
18+
required: false
19+
default: "false"
20+
21+
runs:
22+
using: composite
23+
steps:
24+
- name: Set up uv
25+
uses: astral-sh/setup-uv@v7
26+
27+
- name: Install OS packages
28+
shell: bash
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install -y --allow-downgrades libvirt-dev
32+
33+
- name: Checkout Pro
34+
id: pro-checkout
35+
uses: actions/checkout@v4
36+
continue-on-error: ${{ inputs.fallback-to-main == 'true' }}
37+
with:
38+
repository: localstack/localstack-pro
39+
path: localstack-pro
40+
token: ${{ inputs.pro-token }}
41+
ref: ${{ inputs.pro-ref }}
42+
43+
- name: Pro - fallback to default branch
44+
if: ${{ inputs.fallback-to-main == 'true' && steps.pro-checkout.outcome == 'failure' }}
45+
uses: actions/checkout@v4
46+
with:
47+
repository: localstack/localstack-pro
48+
path: localstack-pro
49+
token: ${{ inputs.pro-token }}
50+
51+
- name: Install Python dependencies for Pro
52+
working-directory: localstack-pro/localstack-pro-aws/
53+
shell: bash
54+
run: make install
55+
56+
- name: Generate spec
57+
shell: bash
58+
run: |
59+
source localstack-pro/localstack-pro-aws/.venv/bin/activate
60+
python bin/update-aws-spec.py ${{ inputs.latest == 'true' && '--latest' || '' }}

.github/workflows/release.yml

Lines changed: 14 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: Release OpenAPI spec
22
on:
33
repository_dispatch:
4-
types: [release-openapi]
54
workflow_dispatch:
65
inputs:
76
releaseVersion:
@@ -10,8 +9,10 @@ on:
109
description: The version to be released
1110

1211
env:
13-
git_user_name: localstack[bot]
14-
git_user_email: localstack-bot@users.noreply.github.com
12+
GIT_AUTHOR_NAME: localstack[bot]
13+
GIT_AUTHOR_EMAIL: localstack-bot@users.noreply.github.com
14+
GIT_COMMITTER_NAME: localstack[bot]
15+
GIT_COMMITTER_EMAIL: localstack-bot@users.noreply.github.com
1516

1617
jobs:
1718
release-localstack-openapi:
@@ -20,63 +21,26 @@ jobs:
2021
release: ${{ github.event_name == 'workflow_dispatch' && inputs.releaseVersion || github.event.client_payload.releaseVersion}}
2122

2223
steps:
23-
- name: "Checkout OpenAPI repo"
24+
- name: Checkout OpenAPI
2425
uses: actions/checkout@v4
2526

26-
- name: "Install release helper"
27-
env:
28-
GITHUB_TOKEN: ${{ secrets.PRO_GITHUB_TOKEN }}
29-
run: |
30-
mkdir -p bin
31-
curl -fsSL \
32-
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
33-
-H "Accept: application/vnd.github.v3.raw" \
34-
"https://api.github.com/repos/localstack/localstack-core/contents/bin/release-helper.sh" \
35-
-o bin/release-helper.sh
36-
chmod +x bin/release-helper.sh
37-
38-
- name: "Prepare git config"
39-
run: |
40-
git config user.name ${{ env.git_user_name }}
41-
git config user.email ${{ env.git_user_email }}
42-
43-
- name: Set up Python
44-
id: setup-python
45-
uses: actions/setup-python@v5
27+
- name: Generate spec
28+
uses: ./.github/actions/generate-spec
4629
with:
47-
python-version: 3.13
48-
49-
- name: "Wait for localstack, localstack-core, and localstack-ext release to appear"
50-
timeout-minutes: 3
51-
run: |
52-
bin/release-helper.sh pip-download-retry localstack ${{ env.release }}
53-
bin/release-helper.sh pip-download-retry localstack-core ${{ env.release }}
54-
bin/release-helper.sh pip-download-retry localstack-ext ${{ env.release }}
55-
56-
- name: Install OS packages
57-
run: |
58-
sudo apt-get update
59-
sudo apt-get install -y --allow-downgrades libsnappy-dev jq libvirt-dev
60-
61-
- name: "Install LocalStack and LocalStack-ext"
62-
run: |
63-
python -m venv .venv
64-
source .venv/bin/activate
65-
pip install localstack-ext==${{ env.release }}
66-
67-
- name: "Create tagged LocalStack OpenAPI spec"
68-
run: |
69-
source .venv/bin/activate
70-
pip install click
71-
pip install pyyaml
72-
python bin/update-aws-spec.py
30+
pro-ref: v${{ env.release }}
31+
pro-token: ${{ secrets.PRO_GITHUB_TOKEN }}
7332

7433
- name: "Commit release version"
7534
# We set the openapi folder as a DEPENDENCY_FILE merely to have it added to the release commit
7635
run: |
7736
DEPENDENCY_FILE="openapi/" bin/release-helper.sh git-commit-release ${{ env.release }}
7837
git push --follow-tags
7938
39+
- name: "Show git modifications"
40+
run: |
41+
git log --oneline -n 2
42+
git show HEAD
43+
8044
- name: Release
8145
uses: softprops/action-gh-release@v2
8246
with:
@@ -85,8 +49,3 @@ jobs:
8549
openapi/emulators/localstack-spec.yml
8650
tag_name: v${{ env.release }}
8751
draft: true
88-
89-
- name: "Show git modifications"
90-
run: |
91-
git log --oneline -n 2
92-
git show HEAD

.github/workflows/update-latest.yml

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Update OpenAPI specs to latest
2-
on:
2+
on:
33
repository_dispatch:
44
types: [openapi-update]
55
workflow_dispatch:
@@ -12,63 +12,14 @@ jobs:
1212
- name: Checkout OpenAPI
1313
uses: actions/checkout@v4
1414

15-
- name: "Set up Python 3.13"
16-
id: setup-python
17-
uses: actions/setup-python@v5
15+
- name: Generate spec
16+
uses: ./.github/actions/generate-spec
1817
with:
19-
python-version: '3.13'
18+
pro-ref: ${{ github.event.client_payload.ref }}
19+
pro-token: ${{ secrets.PRO_GITHUB_TOKEN }}
20+
fallback-to-main: "true"
21+
latest: "true"
2022

21-
- name: Set up uv
22-
uses: astral-sh/setup-uv@v7
23-
24-
- name: Install OS packages
25-
run: |
26-
sudo apt-get update
27-
sudo apt-get install -y --allow-downgrades libsnappy-dev jq libvirt-dev
28-
29-
- name: Checkout Community
30-
uses: actions/checkout@v4
31-
id: community-checkout
32-
continue-on-error: true
33-
with:
34-
repository: localstack/localstack
35-
path: localstack
36-
ref: ${{ github.event.client_payload.ref }}
37-
38-
- name: Community - fallback to main branch
39-
if: steps.community-checkout.outcome == 'failure'
40-
uses: actions/checkout@v4
41-
with:
42-
repository: localstack/localstack
43-
path: localstack
44-
45-
- name: Checkout Pro
46-
uses: actions/checkout@v4
47-
id: pro-checkout
48-
continue-on-error: true
49-
with:
50-
repository: localstack/localstack-pro
51-
path: localstack-pro
52-
token: ${{ secrets.PRO_GITHUB_TOKEN }}
53-
ref: ${{ github.event.client_payload.ref }}
54-
55-
- name: Pro - fallback to main branch
56-
if: steps.pro-checkout.outcome == 'failure'
57-
uses: actions/checkout@v4
58-
with:
59-
repository: localstack/localstack-pro
60-
path: localstack-pro
61-
token: ${{ secrets.PRO_GITHUB_TOKEN }}
62-
63-
- name: Install Python Dependencies for Pro
64-
working-directory: localstack-pro
65-
run: make install
66-
67-
- name: Generate the latest spec
68-
run: |
69-
source localstack-pro/localstack-pro-core/.venv/bin/activate
70-
python bin/update-aws-spec.py --latest
71-
7223
- name: Create PR
7324
uses: peter-evans/create-pull-request@v7
7425
with:

0 commit comments

Comments
 (0)