Skip to content

Commit

Permalink
ci: convert release to semantic-release
Browse files Browse the repository at this point in the history
release-please error'd too often with "There are untagged, merged release PRs
outstanding - aborting" and I couldn't get it to comply. Also see
googleapis/release-please#1946.

The new configuration for semantic-release should do everything we need,
but I'm sure we will need another few rounds to fix the errors I don't see
rn.
  • Loading branch information
sne11ius committed May 23, 2024
1 parent 9022680 commit 5b82f55
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 196 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/release-please.yaml

This file was deleted.

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

on:
workflow_run:
workflows: ["Check"]
types:
- completed
branches:
- main

jobs:
release:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Init node
uses: actions/setup-node@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: false
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install UPX
uses: crazy-max/ghaction-upx@v3
with:
install-only: true
- name: Install semantic-release and plugins globally
run: |
npm install -g semantic-release
npm install -g semantic-release-replace-plugin
npm install -g @semantic-release/exec
npm install -g @semantic-release/changelog
- name: Semantic release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USER: ${{ github.actor }}
1 change: 0 additions & 1 deletion .release-please-manifest.json

This file was deleted.

49 changes: 0 additions & 49 deletions CHANGELOG.md

This file was deleted.

15 changes: 0 additions & 15 deletions api/CHANGELOG.md

This file was deleted.

7 changes: 2 additions & 5 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@ dependencies {

group = "pp"

// Please do not change the following marker comments as they are used by the "release-please" github action.
// See https://github.com/googleapis/release-please/blob/main/docs/customizing.md#updating-arbitrary-files
// x-release-please-start-version
version = "0.0.1"
// x-release-please-end
// Updated via semantic-release-replace-plugin
version = "0.0.0"

java {
sourceCompatibility = VERSION_21
Expand Down
15 changes: 0 additions & 15 deletions client/CHANGELOG.md

This file was deleted.

6 changes: 1 addition & 5 deletions client/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ import (
"github.com/spf13/cobra"
)

// Please do not change the following marker comments as they are used by the "release-please" github action.
// See https://github.com/googleapis/release-please/blob/main/docs/customizing.md#updating-arbitrary-files
// x-release-please-start-version
// Updated via semantic-release-replace-plugin
var version = "0.0.0"

// x-release-please-end

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
for _, setting := range info.Settings {
Expand Down
11 changes: 11 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env sh

set -e

cd client && go build -o pp
# upx --best pp

cd ..

docker build -f api/src/main/docker/Dockerfile.distroless-test -t ghcr.io/sne11ius/pp-api:latest -t ghcr.io/sne11ius/pp-api:"$1" .
docker push ghcr.io/sne11ius/pp-api --all-tags
40 changes: 0 additions & 40 deletions release-please-config.json

This file was deleted.

62 changes: 62 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const releaseConfig = {
branches: ['main'],
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"semantic-release-replace-plugin",
{
"replacements": [
{
"files": ["client/root.go"],
"from": "var version = \".*\"",
"to": "var version = \"${nextRelease.version}\"",
"results": [
{
"file": "client/root.go",
"hasChanged": true,
"numMatches": 1,
"numReplacements": 1
}
],
"countMatches": true
}, {
"files": ["api/build.gradle.kts"],
"from": "version = \".*\"",
"to": "version = \"${nextRelease.version}\"",
"results": [
{
"file": "client/root.go",
"hasChanged": true,
"numMatches": 1,
"numReplacements": 1
}
],
"countMatches": true
}
]
}
],
['@semantic-release/git', {
'assets': [
'client/root.go',
'api/build.gradle.kts',
'CHANGELOG.md'
],
'message': 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}'
}],
["@semantic-release/exec", {
"verifyConditionsCmd": "./verify.sh",
"publishCmd": "./publish.sh ${nextRelease.version}"
}],
'@semantic-release/github'
]
}

module.exports = releaseConfig

0 comments on commit 5b82f55

Please sign in to comment.