Skip to content

Commit

Permalink
Simplify updating release numbers on the site
Browse files Browse the repository at this point in the history
  • Loading branch information
sandermvanvliet committed Jan 5, 2024
1 parent b6cb071 commit d8ec891
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 37 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/pre_release_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,15 @@ jobs:
if: ${{ always() && needs.build_win.result == 'success' && needs.build_macos-x64.result == 'success' }}
steps:
- uses: actions/checkout@v3
with:
ref: main
sparse-checkout:
site/data/releases.yml

- name: Replace pre-release version
shell: bash
run: |
previous_version=`sed -nr "s/.*prerelease%2F([0-9]\.[0-9]*\.[0-9]*\.[0-9]*).*$/\1/p" site/data/releases.yml | head -n 1`
sed -i "s/$previous_version/${{needs.create_release.outputs.version}}/g" site/data/releases.yml
sed -i "s/prerelease_version:.*$/prerelease_version: ${{needs.create_release.outputs.version}}/g" site/data/releases.yml
git config user.email "roadcaptain@roadcaptain.nl"
git config user.name "Roadcaptain (bot)"
git add site/data/releases.yml
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- releases/[0-9]+.[0-9]+.[0-9]+
- releases/[0-9]+.[0-9]+.[0-9]+.[0-9]+

permissions:
contents: write

jobs:
create_release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -212,3 +215,24 @@ jobs:
asset_path: "/Users/runner/work/_temp/RoadCaptain-${{ needs.create_release.outputs.version }}-${{ env.RID }}.dmg" # Explicit path here because $RUNNER_TEMP doesn't get expanded...
asset_name: RoadCaptain-${{ needs.create_release.outputs.version }}-${{ env.RID }}.dmg
asset_content_type: application/x-apple-diskimage

update_site_releases:
runs-on: ubuntu-latest
needs: [create_release, build_win, build_macos-x64, build_macos-arm64]
if: ${{ always() && needs.build_win.result == 'success' && needs.build_macos-x64.result == 'success' }}
steps:
- uses: actions/checkout@v3
with:
ref: main
sparse-checkout:
site/data/releases.yml

- name: Replace pre-release version
shell: bash
run: |
sed -i "s/stable_version:.*$/stable_version: ${{needs.create_release.outputs.version}}/g" site/data/releases.yml
git config user.email "roadcaptain@roadcaptain.nl"
git config user.name "Roadcaptain (bot)"
git add site/data/releases.yml
git commit -m "Update pre-release version on website"
git push
36 changes: 2 additions & 34 deletions site/data/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,5 @@
style: "style1 content-align-center"
id: "releases"
title : "Releases"
content: |
Installers are available for Windows and MacOS.<br /><br />
Typically you will want to download the RoadCaptain stable release. If you want to test out new features as they are worked on you can choose to install the preview release.
However, the preview release will have some rough edges and the occasional bug.<br /><br />
See the <a href="#supportedPlatforms">supported platforms</a> for what is needed to run RoadCaptain.
<table>
<thead>
<tr>
<th></th>
<th>Version</th>
<th>Installers</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Stable release</strong></td>
<td>0.7.0.6 - <a href="https://github.com/sandermvanvliet/RoadCaptain/releases/tag/0.7.0.6">Changelog</a></td>
<td>
<a href="https://github.com/sandermvanvliet/RoadCaptain/releases/download/0.7.0.6/RoadCaptain_0.7.0.6.msi" /><i class="fab fa-windows"></i> Windows</a> |
<a href="https://github.com/sandermvanvliet/RoadCaptain/releases/download/0.7.0.6/RoadCaptain-0.7.0.6-osx-x64.dmg"><i class="fab fa-apple"></i> MacOS</a> |
<a href="#" style="color: grey;text-decoration:line-through"><i class="fab fa-linux"></i> Linux</a>
</td>
</tr>
<tr>
<td><span style="font-style:italic">Preview release</span></td>
<td>0.7.0.6 - <a href="https://github.com/sandermvanvliet/RoadCaptain/releases/tag/prerelease%2F0.7.0.6">Changelog</a></td>
<td>
<a href="https://github.com/sandermvanvliet/RoadCaptain/releases/download/prerelease%2F0.7.0.6/RoadCaptain_0.7.0.6.msi" /><i class="fab fa-windows"></i> Windows</a> |
<a href="https://github.com/sandermvanvliet/RoadCaptain/releases/download/prerelease%2F0.7.0.6/RoadCaptain-0.7.0.6-osx-x64.dmg"><i class="fab fa-apple"></i> MacOS</a> |
<a href="#" style="color: grey;text-decoration:line-through"><i class="fab fa-linux"></i> Linux</a>
</td>
</tr>
</tbody>
</table>
stable_version: 0.7.0.6
prerelease_version: 0.7.1.0
2 changes: 1 addition & 1 deletion site/layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{ partial "items" site.Data.routeBuilderFeatures }}
{{ partial "items" site.Data.runnerFeatures }}
{{ partial "items" site.Data.development }}
{{ partial "items" site.Data.releases }}
{{ partial "releases" site.Data.releases }}
{{ partial "template/footer" . }}

{{ end }}
46 changes: 46 additions & 0 deletions site/themes/roadcaptain/layouts/partials/releases.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!-- Items -->
<section class="wrapper style1 align-center" id="{{ .id }}">
<div class="inner">
<h2><a name="{{ .id }}"><span class="title-anchor icon fal fa-link"></span></a>{{ .title }}</h2>
<p>
Installers are available for Windows and MacOS.<br /><br />
Typically you will want to download the RoadCaptain stable release. If you want to test out new features as they are worked on you can choose to install the preview release.
However, the preview release will have some rough edges and the occasional bug.<br /><br />
See the <a href="#supportedPlatforms">supported platforms</a> for what is needed to run RoadCaptain.
<table>
<thead>
<tr>
<th></th>
<th>Version</th>
<th>Installers</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Stable release</strong></td>
<td>{{ .stable_version }} - <a href="https://github.com/sandermvanvliet/RoadCaptain/releases/tag/{{ .stable_version }}">Changelog</a></td>
<td>
<a href="https://github.com/sandermvanvliet/RoadCaptain/releases/download/{{ .stable_version }}/RoadCaptain_{{ .stable_version }}.msi" /><i class="fab fa-windows"></i> Windows</a> |
<a href="https://github.com/sandermvanvliet/RoadCaptain/releases/download/{{ .stable_version }}/RoadCaptain-{{ .stable_version }}-osx-x64.dmg"><i class="fab fa-apple"></i> MacOS</a> |
<a href="#" style="color: grey;text-decoration:line-through"><i class="fab fa-linux"></i> Linux</a>
</td>
</tr>
<tr>
<td><span style="font-style:italic">Preview release</span></td>
<td>{{.prerelease_version}} - <a href="https://github.com/sandermvanvliet/RoadCaptain/releases/tag/prerelease%2F{{.prerelease_version}}">Changelog</a></td>
<td>
<a href="https://github.com/sandermvanvliet/RoadCaptain/releases/download/prerelease%2F{{.prerelease_version}}/RoadCaptain_{{.prerelease_version}}.msi" /><i class="fab fa-windows"></i> Windows</a> |
<a href="https://github.com/sandermvanvliet/RoadCaptain/releases/download/prerelease%2F{{.prerelease_version}}/RoadCaptain-{{.prerelease_version}}-osx-x64.dmg"><i class="fab fa-apple"></i> MacOS</a> |
<a href="#" style="color: grey;text-decoration:line-through"><i class="fab fa-linux"></i> Linux</a>
</td>
</tr>
</tbody>
</table>
</p>
<div class="items {{ .style }}">
{{ range .items }}
{{ partial "item" . }}
{{ end }}
</div>
</div>
</section>

0 comments on commit d8ec891

Please sign in to comment.