-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (75 loc) · 2.59 KB
/
build-release.yml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Release plugin
on:
pull_request:
branches:
- "main"
- "patch*"
types:
- closed
# push:
# branches: [ "main" ]
env:
PYTHON_VERSION: '3.11.5'
PATH_TO_CONFIG: 'src.s3_platform_plugin_template.config'
CONFIG_FILE: 'config.json'
permissions:
contents: write
jobs:
generate-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install s3p-sdk
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: build config
run: |
python -c "import json; from ${{env.PATH_TO_CONFIG}} import config; print(json.dumps(config.dict()))" > ${{env.CONFIG_FILE}}
- name: Get current date for tag
id: get_date
run: echo "::set-output name=TAG_NAME::v$(date +'%Y%m%d%H%M%S')"
- name: Create Tag
env:
GITHUB_TOKEN: ${{ secrets.PLUGIN_RELEASE_TOKEN }}
run: |
git tag ${{ steps.get_date.outputs.TAG_NAME }}
git push origin ${{ steps.get_date.outputs.TAG_NAME }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PLUGIN_RELEASE_TOKEN }}
with:
tag_name: ${{ steps.get_date.outputs.TAG_NAME }}
release_name: Release ${{ steps.get_date.outputs.TAG_NAME }}
body: |
Autogenerated release ${{ steps.get_date.outputs.TAG_NAME }}
- Config file was generated
draft: false
prerelease: false
- name: Upload config.json to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PLUGIN_RELEASE_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{env.CONFIG_FILE}}
asset_name: ${{env.CONFIG_FILE}}
asset_content_type: application/json
- name: Upload config.json to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PLUGIN_RELEASE_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: './plugin.xml'
asset_name: 'plugin.xml'
asset_content_type: application/json