Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Automation #432

Merged
merged 5 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: Prerelease

########################
### Release Pipeline ###
########################
# This pipeline is triggered when a new tag is pushed to the repository.
# This should usually be triggered by creating a GitHub Release in the repository.
# We use a commitless release workflow, meaning no version numbers are written into
# the repository. You can, therefore, tag any commit you want to make it a release.
#
# The pipeline generally consists of two stages:
# 1. Test things to ensure we don't publish any broken code.
# 2. Publish the code to the respective package registry or the like.
#
# These stages are applied to all libraries in this monorepo.


# Only on release tags – prereleases get handled separately.
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+-**"

# Defines which tool versions should be used in all workflow jobs
env:
node: '22'
pnpm: '9'

# Add the necessary permissions:
# - contents: write
# - id-token: write for the publish-backend-deno job (JSR publishing)
permissions:
contents: write
id-token: write

jobs:
####################
### backend-deno ###
####################
test-backend-deno:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend-deno
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup Virtual Environment 🛠️
run: |-
../backend-features/tools/setup-venv.sh
- name: Run Tests 🧪
run: |-
. ../backend-features/.venv/bin/activate
../backend-features/run-tests.py -v .
publish-backend-deno:
runs-on: ubuntu-latest
needs: test-backend-deno
defaults:
run:
working-directory: ./backend-deno
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup Deno
uses: denolib/setup-deno@v2
with:
deno-version: v2.x
- name: Update version in `deno.json`
run: |
tag=${GITHUB_REF#refs/tags/}
version=${tag#v}
jq --arg version "$version" '.version = $version' deno.json > tmp.$$.json
mv tmp.$$.json deno.json
- name: Publish to JSR
run: deno publish --allow-dirty
##################
### backend-go ###
##################
test-backend-go:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend-go
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup Virtual Environment 🛠️
run: |-
../backend-features/tools/setup-venv.sh
- name: Run Tests 🧪
run: |-
. ../backend-features/.venv/bin/activate
../backend-features/run-tests.py -v .
publish-backend-go:
runs-on: ubuntu-latest
needs: test-backend-go
defaults:
run:
working-directory: ./backend-go
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Create Go Version Tag
run: |
tag=${GITHUB_REF#refs/tags/}
git tag -a "backend-go/$tag" -m "Go Release $tag"
git push origin "backend-go/$tag"
######################
### frontend-react ###
######################
test-frontend-react:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend-react
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup PNPM 💿
uses: pnpm/action-setup@v4
with:
version: ${{ env.pnpm }}
- name: Setup Node 💿
uses: actions/setup-node@v3.8.2
with:
node-version: ${{ env.node }}
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- name: Install dependencies 📚
run: pnpm install
- name: Run unit tests 🛃
run: |
pnpm run ci:test
publish-frontend-react:
runs-on: ubuntu-latest
needs: test-frontend-react
defaults:
run:
working-directory: ./frontend-react
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup PNPM 💿
uses: pnpm/action-setup@v4
with:
version: ${{ env.pnpm }}
- name: Setup Node 💿
uses: actions/setup-node@v3.8.2
with:
node-version: ${{ env.node }}
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- name: Install dependencies 📚
run: pnpm install
- name: Build 🏗️
run: pnpm run build
- name: Update version in `package.json`
run: |
tag=${GITHUB_REF#refs/tags/}
version=${tag#v}
jq --arg version "$version" '.version = $version' package.json > tmp.$$.json
mv tmp.$$.json package.json
- name: Publish to NPM 📦
run: pnpm publish --access public --no-git-checks --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
167 changes: 167 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: Release

########################
### Release Pipeline ###
########################
# This pipeline is triggered when a new tag is pushed to the repository.
# This should usually be triggered by creating a GitHub Release in the repository.
# We use a commitless release workflow, meaning no version numbers are written into
# the repository. You can, therefore, tag any commit you want to make it a release.
#
# The pipeline generally consists of two stages:
# 1. Test things to ensure we don't publish any broken code.
# 2. Publish the code to the respective package registry or the like.
#
# These stages are applied to all libraries in this monorepo.


# Only on release tags – prereleases get handled separately.
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

# Defines which tool versions should be used in all workflow jobs
env:
node: '22'
pnpm: '9'

# Add the necessary permissions:
# - contents: write
# - id-token: write for the publish-backend-deno job (JSR publishing)
permissions:
contents: write
id-token: write

jobs:
####################
### backend-deno ###
####################
test-backend-deno:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend-deno
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup Virtual Environment 🛠️
run: |-
../backend-features/tools/setup-venv.sh
- name: Run Tests 🧪
run: |-
. ../backend-features/.venv/bin/activate
../backend-features/run-tests.py -v .
publish-backend-deno:
runs-on: ubuntu-latest
needs: test-backend-deno
defaults:
run:
working-directory: ./backend-deno
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup Deno
uses: denolib/setup-deno@v2
with:
deno-version: v2.x
- name: Update version in `deno.json`
run: |
tag=${GITHUB_REF#refs/tags/}
version=${tag#v}
jq --arg version "$version" '.version = $version' deno.json > tmp.$$.json
mv tmp.$$.json deno.json
- name: Publish to JSR
run: deno publish --allow-dirty
##################
### backend-go ###
##################
test-backend-go:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend-go
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup Virtual Environment 🛠️
run: |-
../backend-features/tools/setup-venv.sh
- name: Run Tests 🧪
run: |-
. ../backend-features/.venv/bin/activate
../backend-features/run-tests.py -v .
publish-backend-go:
runs-on: ubuntu-latest
needs: test-backend-go
defaults:
run:
working-directory: ./backend-go
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Create Go Version Tag
run: |
tag=${GITHUB_REF#refs/tags/}
git tag -a "backend-go/$tag" -m "Go Release $tag"
git push origin "backend-go/$tag"
######################
### frontend-react ###
######################
test-frontend-react:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend-react
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup PNPM 💿
uses: pnpm/action-setup@v4
with:
version: ${{ env.pnpm }}
- name: Setup Node 💿
uses: actions/setup-node@v3.8.2
with:
node-version: ${{ env.node }}
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- name: Install dependencies 📚
run: pnpm install
- name: Run unit tests 🛃
run: |
pnpm run ci:test
publish-frontend-react:
runs-on: ubuntu-latest
needs: test-frontend-react
defaults:
run:
working-directory: ./frontend-react
steps:
- name: Checkout 📥
uses: actions/checkout@v3.6.0
- name: Setup PNPM 💿
uses: pnpm/action-setup@v4
with:
version: ${{ env.pnpm }}
- name: Setup Node 💿
uses: actions/setup-node@v3.8.2
with:
node-version: ${{ env.node }}
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- name: Install dependencies 📚
run: pnpm install
- name: Build 🏗️
run: pnpm run build
- name: Update version in `package.json`
run: |
tag=${GITHUB_REF#refs/tags/}
version=${tag#v}
jq --arg version "$version" '.version = $version' package.json > tmp.$$.json
mv tmp.$$.json package.json
- name: Publish to NPM 📦
run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
2 changes: 1 addition & 1 deletion backend-deno/deno.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@wuespace/telestion",
"license": "MIT",
"version": "1.0.0-alpha.4",
"version": "0.0.0-to-be-replaced-by-ci",
"exports": "./mod.ts",
"publish": {
"include": [
Expand Down
2 changes: 1 addition & 1 deletion backend-deno/samples/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM denoland/deno:alpine-2.1.2
LABEL version="1.0.0-alpha.4" maintainer="WüSpace e. V. <telestion@wuespace.de>"
LABEL maintainer="WüSpace e. V. <telestion@wuespace.de>"

# Add files
COPY ./mod.ts /app/mod.ts
Expand Down
2 changes: 1 addition & 1 deletion frontend-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}
],
"license": "MIT",
"version": "1.0.0-alpha.4",
"version": "0.0.0-to-be-replaced-by-ci",
"type": "module",
"files": [
"dist",
Expand Down
Loading