Skip to content

Commit 00cca17

Browse files
authored
GitHub release action (#42)
1 parent 613be9f commit 00cca17

File tree

2 files changed

+92
-1
lines changed

2 files changed

+92
-1
lines changed

.github/workflows/release.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
deploy:
10+
name: Build and publish package
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
contents: read
15+
16+
steps:
17+
- name: Checkout main repository
18+
uses: actions/checkout@v4
19+
with:
20+
path: ./multisafepay-python
21+
22+
- name: Get the version
23+
id: get_version
24+
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
25+
26+
- name: Clone Docker container repository
27+
uses: actions/checkout@v4
28+
with:
29+
repository: multisafepay/docker-python
30+
token: ${{ secrets.GLOBAL_GITHUB_TOKEN }}
31+
path: ./docker-python
32+
submodules: 'false'
33+
34+
- name: Setup submodule
35+
run: |
36+
rm -rf ./docker-python/packages-source/multisafepay/multisafepay-python
37+
mv ./multisafepay-python ./docker-python/packages-source/multisafepay/multisafepay-python
38+
39+
- name: Copy environment file
40+
run: cp .env.example .env
41+
working-directory: ./docker-python
42+
43+
- name: Replace environment variable
44+
run: sed -i "s/^PYTHON_VERSION=.*/PYTHON_VERSION=3.12/" .env
45+
working-directory: ./docker-python
46+
47+
- name: Setup containers and application
48+
run: bin/setup
49+
working-directory: ./docker-python
50+
51+
- name: Build package
52+
run: bin/build
53+
working-directory: ./docker-python
54+
55+
- name: Publish package to PyPI
56+
uses: pypa/gh-action-pypi-publish@release/v1
57+
with:
58+
packages-dir: ./docker-python/packages-source/multisafepay/multisafepay-python/dist/
59+
60+
- name: Create Release
61+
id: create_release
62+
uses: actions/create-release@v1
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GLOBAL_GITHUB_TOKEN }}
65+
with:
66+
tag_name: ${{ env.VERSION }}
67+
release_name: ${{ env.VERSION }}
68+
draft: true
69+
prerelease: false
70+
71+
- name: Upload Release Asset
72+
id: upload-release-asset
73+
uses: actions/upload-release-asset@v1
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GLOBAL_GITHUB_TOKEN }}
76+
with:
77+
upload_url: ${{ steps.create_release.outputs.upload_url }}
78+
asset_path: ./docker-python/packages-source/multisafepay/multisafepay-python/dist/multisafepay-${{ env.VERSION }}.tar.gz
79+
asset_name: multisafepay-${{ env.VERSION }}.tar.gz
80+
asset_content_type: application/zip
81+
82+
- name: Upload Release Asset 2
83+
id: upload-release-asset-2
84+
uses: actions/upload-release-asset@v1
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GLOBAL_GITHUB_TOKEN }}
87+
with:
88+
upload_url: ${{ steps.create_release.outputs.upload_url }}
89+
asset_path: ./docker-python/packages-source/multisafepay/multisafepay-python/dist/multisafepay-${{ env.VERSION }}-py3-none-any.whl
90+
asset_name: multisafepay-${{ env.VERSION }}-py3-none-any.whl
91+
asset_content_type: application/octet-stream

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ authors = ["Multisafepay <[email protected]>"]
33
description = "Multisafepay API wrapper"
44
license = "OSL-3.0"
55
name = "multisafepay"
6-
version = "0.1.0"
6+
version = "1.0.0rc1"
77

88
[tool.poetry.dependencies]
99
python = ">=3.8,<3.14"

0 commit comments

Comments
 (0)