Skip to content

Commit 42d4683

Browse files
authored
Merge pull request #17 from tuist/automate-release
Automate releases
2 parents 0acf029 + c69f8d5 commit 42d4683

File tree

5 files changed

+112
-2
lines changed

5 files changed

+112
-2
lines changed

.github/FUNDING.yml

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

.github/changelog-configuration.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"categories": [
3+
{
4+
"title": "#### Changed",
5+
"labels": ["changelog:changed"]
6+
},
7+
{
8+
"title": "#### Added",
9+
"labels": ["changelog:added"]
10+
},
11+
{
12+
"title": "#### Fixed",
13+
"labels": ["changelog:fixed"]
14+
}
15+
],
16+
"pr_template": "- ${{TITLE}} [#${{NUMBER}}](https://github.com/tuist/XcodeGraph/pull/${{NUMBER}}) by [@${{AUTHOR}}](https://github.com/${{AUTHOR}})"
17+
}

.github/workflows/release.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to release (optional)'
11+
required: false
12+
type: string
13+
14+
concurrency:
15+
group: release-${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
permissions:
19+
contents: write
20+
pull-requests: read
21+
statuses: write
22+
23+
jobs:
24+
continuous:
25+
name: Continuous
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Determine version
30+
id: get_version
31+
run: |
32+
if [ -n "${{ github.event.inputs.version }}" ]; then
33+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
34+
else
35+
echo "No version provided, calculating next version..."
36+
fi
37+
- name: Calculate next version
38+
if: steps.get_version.outputs.VERSION == ''
39+
uses: ietf-tools/semver-action@v1
40+
id: semver
41+
with:
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
branch: main
44+
- name: Set final version
45+
id: set_version
46+
run: |
47+
if [ -n "${{ steps.get_version.outputs.VERSION }}" ]; then
48+
echo "version=${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_OUTPUT
49+
else
50+
echo "version=${{ steps.semver.outputs.next }}" >> $GITHUB_OUTPUT
51+
fi
52+
- name: "Generate Tuist Changelog"
53+
id: changelog
54+
uses: mikepenz/release-changelog-builder-action@v2
55+
with:
56+
owner: "tuist"
57+
repo: "XcodeGraph"
58+
configuration: ".github/changelog-configuration.json"
59+
- name: Check if there are categorized PRs
60+
id: check_prs
61+
run: |
62+
if [ "${{ steps.changelog.outputs.categorized_prs }}" = "0" ]; then
63+
echo "skip_next_steps=true" >> $GITHUB_OUTPUT
64+
else
65+
echo "skip_next_steps=false" >> $GITHUB_OUTPUT
66+
fi
67+
- name: Update Changelog
68+
uses: stefanzweifel/changelog-updater-action@v1
69+
if: steps.check_prs.outputs.skip_next_steps != 'true'
70+
with:
71+
latest-version: ${{ steps.set_version.outputs.version }}
72+
release-notes: ${{ steps.changelog.outputs.changelog }}
73+
path-to-changelog: CHANGELOG.md
74+
- uses: stefanzweifel/git-auto-commit-action@v5
75+
if: steps.check_prs.outputs.skip_next_steps != 'true'
76+
with:
77+
commit_message: "Version ${{ steps.set_version.outputs.version }}"
78+
tagging_message: ${{ steps.set_version.outputs.version }}
79+
commit_options: '--allow-empty'
80+
- name: Create GitHub Release on the tuist/XcodeGraph repository
81+
if: steps.check_prs.outputs.skip_next_steps != 'true'
82+
uses: softprops/action-gh-release@v1
83+
with:
84+
draft: false
85+
repository: tuist/XcodeGraph
86+
name: ${{ steps.set_version.outputs.version }}
87+
tag_name: ${{ steps.set_version.outputs.version }}
88+
body: ${{ steps.changelog.outputs.changelog }}

BREAKME.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# BREAKME
2+
3+
This document lists breaking changes to introduce in the next major version of the project.
4+
Every change must include what needs to be changed, and the rationale behind it.
5+
6+
## Changes

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Changelog

0 commit comments

Comments
 (0)