Skip to content

Commit 6a1d170

Browse files
Merge pull request #7 from madMathematician971/develop
Simplified CI (Release to main)
2 parents 63a09fa + ac46968 commit 6a1d170

File tree

5 files changed

+59
-124
lines changed

5 files changed

+59
-124
lines changed

.github/workflows/bump-minor.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/bump-patch.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Bump Patch Version
33
on:
44
push:
55
branches:
6-
- develop
6+
- main
77

88
jobs:
99
bump-patch:
@@ -45,7 +45,6 @@ jobs:
4545
4646
git add pyproject.toml
4747
git commit -m "ci: bump patch version to v${{ steps.bump_version.outputs.VERSION }} [skip ci]" || echo "No changes"
48-
git tag v${{ steps.bump_version.outputs.VERSION }} || echo "Tag exists"
4948
5049
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
51-
git push origin HEAD:develop --follow-tags
50+
git push origin HEAD:main

.github/workflows/ci-deploy.yml

Lines changed: 8 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,25 @@
11
name: Deploy
22

33
on:
4-
push:
5-
branches:
6-
- 'release/*'
7-
workflow_run:
8-
workflows:
9-
- Bump Minor Version
10-
types:
11-
- completed
4+
release:
5+
types: [published]
126

137
jobs:
14-
create_release:
15-
name: Create Release and Tag
16-
if: >-
17-
github.event.workflow_run.conclusion == 'success' &&
18-
github.event.workflow_run.head_branch == 'main'
19-
permissions:
20-
contents: write
21-
runs-on: ubuntu-latest
22-
environment: production
23-
steps:
24-
- name: Generate token
25-
id: generate_token
26-
uses: actions/create-github-app-token@v1
27-
with:
28-
app-id: ${{ secrets.VERSION_BUMP_APP_ID }}
29-
private-key: ${{ secrets.VERSION_BUMP_APP_TOKEN }}
30-
31-
- uses: actions/checkout@v4
32-
with:
33-
token: ${{ steps.generate_token.outputs.token }} # Use the generated token
34-
35-
- name: Install uv and dev dependencies
36-
run: |
37-
curl -LsSf https://astral.sh/uv/install.sh | sh
38-
uv sync --only-dev
39-
40-
- name: Extract version
41-
id: extract_version
42-
run: |
43-
echo "VERSION=$(uv run --no-sync poetry version -s)" >> $GITHUB_OUTPUT
44-
45-
- name: Create GitHub Release
46-
uses: actions/create-release@v1
47-
with:
48-
tag_name: v${{ steps.extract_version.outputs.VERSION }}
49-
release_name: v${{ steps.extract_version.outputs.VERSION }}
50-
body: "Release v${{ steps.extract_version.outputs.VERSION }}"
51-
env:
52-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53-
54-
- name: Create and push release branch
55-
env:
56-
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
57-
run: |
58-
git config user.name "${{ secrets.VERSION_BUMP_APP_ID }}[bot]"
59-
git config user.email "${{ secrets.VERSION_BUMP_APP_ID }}[bot]@users.noreply.github.com"
60-
61-
git checkout -b "release/v${{ steps.extract_version.outputs.VERSION }}"
62-
63-
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
64-
git push origin "release/v${{ steps.extract_version.outputs.VERSION }}"
65-
668
deploy_images:
679
name: Deploy Docker Images
68-
if: >-
69-
github.event_name == 'push' &&
70-
startsWith(github.ref, 'refs/heads/release/')
7110
runs-on: ubuntu-latest
7211
environment: production
7312
steps:
74-
- uses: actions/checkout@v4
75-
76-
- name: Install uv and dev dependencies
77-
run: |
78-
curl -LsSf https://astral.sh/uv/install.sh | sh
79-
uv sync --only-dev
13+
- name: Checkout code at release tag
14+
uses: actions/checkout@v4
15+
with:
16+
ref: ${{ github.event.release.tag_name }}
8017

8118
- name: Extract version
8219
id: extract_version
8320
run: |
84-
echo "VERSION=$(uv run --no-sync poetry version -s)" >> $GITHUB_OUTPUT
21+
TAG_NAME="${{ github.event.release.tag_name }}"
22+
echo "VERSION=${TAG_NAME#v}" >> $GITHUB_OUTPUT
8523
8624
- name: Log in to Docker Hub
8725
uses: docker/login-action@v2

.github/workflows/ci-release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- Bump Patch Version
7+
types:
8+
- completed
9+
10+
jobs:
11+
create_release:
12+
name: Create Release and Tag
13+
permissions:
14+
contents: write
15+
runs-on: ubuntu-latest
16+
environment: production
17+
steps:
18+
- name: Generate token
19+
id: generate_token
20+
uses: actions/create-github-app-token@v1
21+
with:
22+
app-id: ${{ secrets.VERSION_BUMP_APP_ID }}
23+
private-key: ${{ secrets.VERSION_BUMP_APP_TOKEN }}
24+
25+
- uses: actions/checkout@v4
26+
with:
27+
token: ${{ steps.generate_token.outputs.token }} # Use the generated token
28+
fetch-depth: 0
29+
30+
- name: Install uv and dev dependencies
31+
run: |
32+
curl -LsSf https://astral.sh/uv/install.sh | sh
33+
uv sync --only-dev
34+
35+
- name: Extract version
36+
id: extract_version
37+
run: |
38+
echo "VERSION=$(uv run --no-sync poetry version -s)" >> $GITHUB_OUTPUT
39+
40+
- name: Create GitHub Release
41+
uses: actions/create-release@v1
42+
with:
43+
tag_name: v${{ steps.extract_version.outputs.VERSION }}
44+
release_name: v${{ steps.extract_version.outputs.VERSION }}
45+
body: "Release v${{ steps.extract_version.outputs.VERSION }}"
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "it-tools-api"
3-
version = "0.1.3"
3+
version = "0.1.4"
44
description = "API for IT Tools"
55
authors = [
66
{ name = "Anton Dmytrenko", email = "48_decorum.row@icloud.com" },

0 commit comments

Comments
 (0)