-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.55 KB
/
test_and_release.yaml
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
name: test_and_release
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
create_tag:
permissions:
contents: write
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: [ 3.11 ]
name: A job to test the functionalities of the code
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Installing Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Installing this repo as a Python package
run: |
python3 -m pip install ${{ github.workspace }}
- name: Installing GitHubApiHelper
run: |
python3 -m pip install git+https://github.com/zhenghaven/[email protected]
- name: Get latest version
id: latest_ver
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python3 -m GitHubApiHelper --auth-token \
api_tags_latest_ver \
--repo ${{ github.repository }} \
-l $(python3 -m zyAPI --version) \
--github-out
- name: Create tag
if: ${{ startsWith(github.ref, 'refs/heads/main') && steps.latest_ver.outputs.remote != steps.latest_ver.outputs.all }}
uses: actions/github-script@v6
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ steps.latest_ver.outputs.allV }}',
sha: context.sha
})