Skip to content

Commit 838209b

Browse files
authored
Merge pull request #12 from CIAT-DAPA/jchemutt_dev
Fixed Github Workflows
2 parents 2f70b69 + 917b59d commit 838209b

File tree

1 file changed

+86
-91
lines changed

1 file changed

+86
-91
lines changed

.github/workflows/test_pipeline.yml

+86-91
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,39 @@ name: Devops SPCAT_WEBAPI
55

66
on:
77
push:
8-
branches: [ "stage" ]
8+
branches: ["stage"]
99
tags:
10-
- 'v*'
11-
10+
- "v*"
1211

1312
permissions:
1413
contents: read
1514

1615
jobs:
17-
18-
# ------- START ORM PROCCESS -------- #
16+
# ------- START ORM PROCCESS -------- #
1917

2018
TestAPI:
21-
2219
runs-on: ubuntu-latest
2320

2421
steps:
25-
- uses: actions/checkout@v3
26-
- name: Set up Python 3.9
27-
uses: actions/setup-python@v3
28-
with:
29-
python-version: "3.9"
30-
- name: Create environment
31-
run: |
32-
python -m venv env
33-
- name: Active environment
34-
run: |
35-
source env/bin/activate
36-
- name: Install dependencies
37-
run: |
38-
pip install -r ./src/requirements.txt
39-
- name: Run Tests
40-
run: |
41-
python -m unittest discover -s ./src/tests/ -p 'test_*.py'
42-
# ------- END ORM PROCCESS -------- #
43-
44-
# ------- START MERGE PROCCESS -------- #
22+
- uses: actions/checkout@v3
23+
- name: Set up Python 3.9
24+
uses: actions/setup-python@v3
25+
with:
26+
python-version: "3.9"
27+
- name: Create environment
28+
run: |
29+
python -m venv env
30+
- name: Active environment
31+
run: |
32+
source env/bin/activate
33+
- name: Install dependencies
34+
run: |
35+
pip install -r ./src/requirements.txt
36+
- name: Run Tests
37+
run: |
38+
python -m unittest discover -s ./src/tests/ -p 'test_*.py'
39+
# ------- END ORM PROCCESS -------- #
40+
# ------- START MERGE PROCCESS -------- #
4541

4642
MergeMainAPI:
4743
needs: TestAPI
@@ -59,76 +55,75 @@ jobs:
5955
target_branch: main
6056
github_token: ${{ github.token }}
6157

62-
# ------- END MERGE PROCCESS -------- #
58+
# ------- END MERGE PROCCESS -------- #
6359

64-
# ------- START RELEASE PROCCESS -------- #
60+
# ------- START RELEASE PROCCESS -------- #
6561

6662
PostRelease:
6763
needs: MergeMainAPI
6864
name: Create Release
6965
runs-on: ubuntu-latest
7066
permissions: write-all
7167
steps:
72-
- uses: actions/checkout@v3
73-
with:
74-
fetch-depth: '0'
75-
# Generate Tagname
76-
- name: Generate Tagname for release
77-
id: taggerDryRun
78-
uses: anothrNick/github-tag-action@1.61.0
79-
env:
80-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81-
WITH_V: true
82-
DRY_RUN: true
83-
DEFAULT_BUMP: patch
84-
RELEASE_BRANCHES : stage,main
85-
BRANCH_HISTORY: last
86-
# update version swagger.json
87-
- name: Checkout code
88-
uses: actions/checkout@v3
89-
with:
90-
ref: main
91-
- name: Update version
92-
run: |
93-
sed -i "s/"version": ".*"/version: "${{ steps.taggerDryRun.outputs.new_tag }}"/" src/static/swagger.json
94-
env:
95-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96-
- name: Commit changes
97-
uses: stefanzweifel/git-auto-commit-action@v4
98-
with:
99-
commit_message: "Update version to ${{ steps.taggerDryRun.outputs.new_tag }}"
100-
# API Zip
101-
- name: Zip artifact for deployment
102-
run: cd ./src && zip -r ../releaseAPI.zip ./* && cd ..
103-
# Upload Artifacts
104-
- name: Upload ORM artifact for deployment job
105-
uses: actions/upload-artifact@v3
106-
with:
107-
name: API
108-
path: releaseAPI.zip
109-
# Create release
110-
- name: Create Release
111-
id: create_release
112-
uses: actions/create-release@v1
113-
env:
114-
GITHUB_TOKEN: ${{ github.token }}
115-
with:
116-
tag_name: ${{ steps.taggerDryRun.outputs.new_tag }}
117-
release_name: Release ${{ steps.taggerDryRun.outputs.new_tag }}
118-
#body_path: ./body.md
119-
body: ${{ github.event.head_commit.message }}
120-
draft: false
121-
prerelease: false
122-
# Upload Assets to release
123-
- name: Upload Release Asset API
124-
id: upload-api-release-asset
125-
uses: actions/upload-release-asset@v1
126-
env:
127-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128-
with:
129-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
130-
asset_path: ./releaseAPI.zip
131-
asset_name: releaseAPI.zip
132-
asset_content_type: application/zip
133-
134-
# ------- END RELEASE PROCCESS -------- #
68+
- uses: actions/checkout@v3
69+
with:
70+
fetch-depth: "0"
71+
# Generate Tagname
72+
- name: Generate Tagname for release
73+
id: taggerDryRun
74+
uses: anothrNick/github-tag-action@1.61.0
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
WITH_V: true
78+
DRY_RUN: true
79+
DEFAULT_BUMP: patch
80+
RELEASE_BRANCHES: stage,main
81+
BRANCH_HISTORY: last
82+
# update version swagger.json
83+
- name: Checkout code
84+
uses: actions/checkout@v3
85+
with:
86+
ref: main
87+
- name: Update version
88+
run: |
89+
sed -i "s/"version": ".*"/version: "${{ steps.taggerDryRun.outputs.new_tag }}"/" src/static/swagger.json
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
- name: Commit changes
93+
uses: stefanzweifel/git-auto-commit-action@v4
94+
with:
95+
commit_message: "Update version to ${{ steps.taggerDryRun.outputs.new_tag }}"
96+
# API Zip
97+
- name: Zip artifact for deployment
98+
run: cd ./src && zip -r ../releaseAPI.zip ./* && cd ..
99+
# Upload Artifacts
100+
- name: Upload ORM artifact for deployment job
101+
uses: actions/upload-artifact@v4
102+
with:
103+
name: API
104+
path: releaseAPI.zip
105+
# Create release
106+
- name: Create Release
107+
id: create_release
108+
uses: actions/create-release@v1
109+
env:
110+
GITHUB_TOKEN: ${{ github.token }}
111+
with:
112+
tag_name: ${{ steps.taggerDryRun.outputs.new_tag }}
113+
release_name: Release ${{ steps.taggerDryRun.outputs.new_tag }}
114+
#body_path: ./body.md
115+
body: ${{ github.event.head_commit.message }}
116+
draft: false
117+
prerelease: false
118+
# Upload Assets to release
119+
- name: Upload Release Asset API
120+
id: upload-api-release-asset
121+
uses: actions/upload-release-asset@v1
122+
env:
123+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124+
with:
125+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
126+
asset_path: ./releaseAPI.zip
127+
asset_name: releaseAPI.zip
128+
asset_content_type: application/zip
129+
# ------- END RELEASE PROCCESS -------- #

0 commit comments

Comments
 (0)