Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
greeeen-dev authored Dec 11, 2024
2 parents 1b6b430 + d4aeda8 commit b15f5d0
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 56 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/release-alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ jobs:
name: "Create alpha release"
uses: ./.github/workflows/release.yml
with:
type: alpha
environment: Alpha release
staging: false
type: alpha
staging: false
branch: dev
branch_version: dev
pre_release: true
secrets:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
16 changes: 16 additions & 0 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release (Beta)
on: workflow_dispatch

jobs:
release:
name: "Create beta release"
uses: ./.github/workflows/release.yml
with:
environment: Beta release
type: beta
staging: false
branch: dev
branch_version: beta
pre_release: true
secrets:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
16 changes: 16 additions & 0 deletions .github/workflows/release-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release (Stable)
on: workflow_dispatch

jobs:
release:
name: "Create release"
uses: ./.github/workflows/release.yml
with:
environment: Stable release
type: stable
staging: false
branch: main
branch_version: main
pre_release: false
secrets:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
11 changes: 8 additions & 3 deletions .github/workflows/release-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ on: workflow_dispatch

jobs:
release:
name: "Create alpha release"
name: "Create simulated alpha release"
uses: ./.github/workflows/release.yml
with:
type: alpha
environment: Alpha release
staging: false
type: alpha
staging: true
branch: dev
branch_version: dev
pre_release: true
secrets:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
94 changes: 73 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,29 @@ on:
type: string
description: "The release type, must be stable, beta, or alpha."
default: "alpha"
environment:
type: string
description: "The environment to use."
default: "Alpha release"
staging:
type: boolean
description: "Whether the release should be simulated or not."
default: false
branch:
type: string
description: "The branch to release from."
default: "main"
branch_version:
type: string
description: "The branch on unifier-version to bump."
default: "main"
pre_release:
type: boolean
description: "Whether the release should be a pre-release or not."
default: false
environment:
type: string
description: "The environment to release to."
default: "Alpha release"
secrets:
DEPLOY_KEY:
required: true

permissions:
contents: write
Expand All @@ -23,29 +38,23 @@ jobs:
validate-input:
name: "Validate inputs"
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH }}
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Validate inputs
run: "python3 ./scripts/validate.py \"${{ toJSON(github.event.inputs) }}\""
pylint:
name: "Run Pylint"
uses: ./.github/workflows/pylint.yml
run: "python3 ./scripts/validate.py ${{ inputs.type }} ${{ inputs.staging }}"

create-release:
name: "Create release"
runs-on: ubuntu-latest
needs: [validate-input, pylint]
environment: ${{ inputs.environment }}
needs: [validate-input]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH }}
ref: ${{ inputs.branch }}
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
Expand All @@ -58,27 +67,38 @@ jobs:
python3 ./scripts/get_version.py
- name: Get release notes
run: |
echo "NOTES=$(python3 ./scripts/get_notes.py '${{ env.VERSION }}')" >> $GITHUB_ENV
{
echo 'NOTES<<EOF'
python3 ./scripts/get_notes.py '${{ env.VERSION }}'
echo EOF
} >> $GITHUB_ENV
- name: Create GitHub release
uses: elgohr/Github-Release-Action@v5
uses: ncipollo/[email protected]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: ${{ env.RAW_VERSION }}
name: ${{ env.RAW_VERSION }}
tag: ${{ env.VERSION }}
prerelease: ${{ env.PRE_RELEASE }}
prerelease: ${{ inputs.pre_release }}
body: ${{ env.NOTES }}
commit: ${{ inputs.branch }}
draft: ${{ inputs.staging }}
skipIfReleaseExists: true
publish-release:
name: "Publish release"
runs-on: ubuntu-latest
needs: [create-release]
environment: ${{ inputs.environment }}
if: ${{ !inputs.staging }}
if: ${{ inputs.staging == false }}
steps:
- uses: actions/checkout@v4
with:
repository: 'UnifierHQ/unifier-version'
ref: ${{ env.BRANCH_VERSION }}
ref: ${{ inputs.branch_version }}
token: ${{ secrets.DEPLOY_KEY }}
- name: Download Unifier
run: |
git clone --branch ${{ inputs.branch }} https://github.com/UnifierHQ/unifier
- name: Set up Git config
run: |
git config --global user.name "GitHub Actions"
Expand All @@ -90,8 +110,40 @@ jobs:
- name: Bump version
run: |
python3 ./scripts/bump.py
- name: Delete Unifier
run: |
rm -rf ./unifier
- name: Push to repository
run: |
git add .
git commit -m "Version bump to ${{ env.VERSION }}"
git commit -m "Version bump for release"
git push
publish-release-staging:
name: "Simulate release"
runs-on: ubuntu-latest
needs: [ create-release ]
environment: ${{ inputs.environment }}
if: ${{ inputs.staging == true }}
steps:
- uses: actions/checkout@v4
with:
repository: 'UnifierHQ/unifier-version'
ref: ${{ inputs.branch_version }}
- name: Download Unifier
run: |
git clone --branch ${{ inputs.branch }} https://github.com/UnifierHQ/unifier
- name: Set up Git config
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "<>"
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Bump version
run: |
python3 ./scripts/bump.py
- name: Delete Unifier
run: |
rm -rf ./unifier
3 changes: 1 addition & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ All EoL dates are in dd/mm/yyyy format.
| ------------------------------ | -------- | ---------------------------- | ---------- |
| 3.x (`elegant-elderberry`) | release | :white_check_mark: Supported | Not legacy |
| 2.x LTS (`daring-dragonfruit`) | legacy | :white_check_mark: Supported | 17/07/2025 |
| 1.2.x (`cheerful-cranberry`) | legacy | :warning: Nearing EoL | 05/12/2024 |
| < 1.2 | eol | :x: Unsupported | EoL |
| < 2.0 | eol | :x: Unsupported | EoL |

### What do the types mean?
- `release`: This is the newest series and is in active development.
Expand Down
12 changes: 5 additions & 7 deletions scripts/validate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import sys
import json
import os

data = json.loads(sys.argv[1])
data = {
'type': sys.argv[1],
'staging': sys.argv[2]
}

# arguments to validate
validation = {
Expand All @@ -12,14 +14,10 @@
'explicit': ['alpha', 'beta', 'stable']
}
},
'environment': {
'require_all': True,
'strategy': {}
},
'staging': {
'require_all': True,
'strategy': {
'explicit': [True, False]
'explicit': ['true', 'false']
}
}
}
Expand Down
21 changes: 0 additions & 21 deletions update.json

This file was deleted.

0 comments on commit b15f5d0

Please sign in to comment.