Skip to content

Commit

Permalink
ci: add release workflow (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ovsds authored Jan 18, 2024
1 parent 4c4a508 commit 83e5325
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
python_version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Task
uses: arduino/setup-task@v1
with:
Expand All @@ -35,9 +38,6 @@ jobs:
with:
version: 1.7.1

- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: task ci-init

Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release

on:
push:
branches:
- main
workflow_dispatch:

jobs:
get_versions:
name: Get local and remote versions
runs-on: ubuntu-22.04

permissions:
contents: read

outputs:
local_version: ${{ steps.get_local_version.outputs.local_version }}
remote_version: ${{ steps.get_remote_version.outputs.remote_version }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1

- name: Get local version
id: get_local_version
run: echo "local_version=$(poetry version --short)" >> $GITHUB_OUTPUT

- name: Get remote version
id: get_remote_version
run: |
remote_version=$(curl https://pypi.org/pypi/secret-transfer/json | jq -r '.info.version' || echo "0.0.0")
echo "remote_version=$remote_version" >> $GITHUB_OUTPUT
release:
name: Release
runs-on: ubuntu-22.04

needs: [get_versions]
if: ${{ needs.get_versions.outputs.local_version != needs.get_versions.outputs.remote_version }}

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.33.1

- name: Set up Python
uses: actions/setup-python@v4

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1

- name: Install dependencies
run: task ci-init

- name: Build
run: task ci-package-build

- name: Publish
run: task ci-package-publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}

- name: Create release
uses: ncipollo/release-action@v1
with:
token: ${{ github.token }}
tag: ${{ needs.get_versions.outputs.local_version }}
artifacts: "dist/*"
generateReleaseNotes: true
skipIfReleaseExists: true
21 changes: 21 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 ovsds-example-organizaton

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 0 additions & 8 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,6 @@ tasks:
- echo 'Installing python dependencies...'
- poetry install

ci-login-pypi-publish:
desc: Login to PyPI (CI-specific)
requires:
envs: [PYPI_TOKEN]
cmds:
- echo 'Logging in to PyPI...'
- poetry config pypi-token.pypi $PYPI_TOKEN

ci-package-build:
desc: Build package (CI-specific)
cmds:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ license = "MIT"
name = "secret-transfer"
readme = "README.md"
repository = "https://github.com/ovsds/secret-transfer"
version = "0.1.0"
version = "0.2.0"

[tool.poetry.dependencies]
click = "^8.1.3"
Expand Down

0 comments on commit 83e5325

Please sign in to comment.