Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
auto release on semver-named tags (#190)
Browse files Browse the repository at this point in the history
* auto release zip'd builds

* merged build steps into the Release and Debug jobs
* zips up builds using win10's tar.exe
* publishes the zip files using github's release api, allowing anyone to download them even without a github account
* kept artifacts just to avoid breaking the discord webhook. could change this at some point.

* bugfix: strings are single-quoted

* don't actually know. seems like yaml supports either.

* bugfix: removed '.' directory from zip archive

* auto-release now triggers on semver-named tags

steps to trigger auto-release:
1. push your commit to any branch
2. tag your commit using semver name (see below)
3. push tag

for semver naming, please use this format:
v1.2.3-featureName+1.0.1

v1.2.3 refers to the main branch version when you create your feature branch (or last pulled from main)
+1.0.1 refers to the version of your feature, independent of the main branch version.

the values "1.2.3" and "1.0.1":
* the last number represents a minor change (bugfix, regenerating cpp scaffolding, changing a literal, etc)
* the middle number represents a new feature (so, when merging feature branches into main, tag that and increment this middle number)
* the first number represents a major rewrite of the entire project.

incrementing a number should 'reset' the numbers to the right. eg; v1.0.23 should become v1.1.0 once merging a new feature.

any individual number can extend beyond single digits, ex: v1.0.10 is the tenth minor patch.

* bugfix: release already exists

merged debug job into one giant BuildAndRelease job.

* test feature 112

commit name doesn't affect anything, it's just for my reference.

testing the generation of the changelog by auto-release for semver-named feature branches.

* test feature 113 no-release

commit name doesn't affect anything, it's just for my reference.

testing the generation of the changelog by auto-release for semver-named feature branches.

* test feature 114 no-release

commit name doesn't affect anything, it's just for my reference.

testing the generation of the changelog by auto-release for semver-named feature branches.

* test feature 115

commit name doesn't affect anything, it's just for my reference.

testing the generation of the changelog by auto-release for semver-named feature branches.

* test main 101

commit name doesn't affect anything, it's just for my reference.

testing the generation of the changelog by auto-release

* discord webhook should link to the release now

seems a little janky but it works on my private repo & discord, i swear.

artifacts are still kept for bitbot compatibility

* separated jobs

* bugfix: error in yaml syntax

* bugfix: more indentation issues

* bugfix: more indentation..

* standardized line endings and indentations

line by line the entire file. if this fails then github actions is broken.

* bugfix: forgot checkout action
  • Loading branch information
kotae4 authored May 19, 2021
1 parent 61cca96 commit feca973
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 48 deletions.
117 changes: 70 additions & 47 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ name: Build Project

on:
push:
branches:
- main
tags:
- v[0-9].[0-9]+.[0-9]+*
# pr's will trigger this action. i think the idea here is to verify that a build is passing before merging.
pull_request:
branches:
- main

jobs:
Release:
Build_Release:
runs-on: windows-latest
steps:
- name: Checkout
Expand All @@ -22,36 +23,19 @@ jobs:
- name: Build Release_Version
shell: bash
run: '"/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe" -property:Configuration=Release_Version'

- name: Upload Artifact
if: ${{ github.event_name == 'push' }}
uses: actions/[email protected]
with:
name: Release
path: |
./Release/AmongUsMenu.dll
./Release_Version/version.dll
./LICENSE
- name: Package Builds

- name: Package Release Builds
if: ${{ github.event_name == 'push' }}
run: tar -caf Release_${{ github.sha }}.zip Release/AmongUsMenu.dll Release_Version/version.dll LICENSE

- name: Automatic Releases
- name: Upload Release Artifact
if: ${{ github.event_name == 'push' }}
uses: marvinpinto/action-automatic-releases@latest
id: "automatic_releases"
uses: actions/[email protected]
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest-release"
prerelease: true
title: "Release Build"
files: |
Release_${{ github.sha }}.zip
# note, we can invoke the discord webhook here and send it ${{ steps.automatic_releases.outputs.upload_url }} for a direct link to the release
# if we do that we can probably remove the artifact uploads entirely unless there's a reason to keep them?

Debug:
name: Release
path: Release_${{ github.sha }}.zip

Build_Debug:
runs-on: windows-latest
steps:
- name: Checkout
Expand All @@ -64,42 +48,81 @@ jobs:
- name: Build Debug_Version
shell: bash
run: '"/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe" -property:Configuration=Debug_Version'

- name: Upload Artifact
if: ${{ github.event_name == 'push' }}
uses: actions/[email protected]
with:
name: Debug
path: |
./Debug/AmongUsMenu.dll
./Debug_Version/version.dll
./LICENSE
- name: Package Builds

- name: Package Debug Builds
if: ${{ github.event_name == 'push' }}
run: tar -caf Debug_${{ github.sha }}.zip Debug/AmongUsMenu.dll Debug_Version/version.dll LICENSE

- name: Upload Debug Artifact
if: ${{ github.event_name == 'push' }}
uses: actions/[email protected]
with:
name: Debug
path: Debug_${{ github.sha }}.zip

AutoRelease:
if: ${{ github.event_name == 'push' }}
runs-on: windows-latest
needs: [Build_Release, Build_Debug]
steps:
- name: Parse tag semver
uses: booxmedialtd/ws-action-parse-semver@3576f3a20a39f8752fe0d8195f5ed384090285dc
id: semver_parser
with:
input_string: ${{ github.ref }}
version_extractor_regex: '\/v(.*)$'

# please keep this for an adjustment period, will help diagnose any issues
- name: Debug semver
run: |
echo 'major: ${{ steps.semver_parser.outputs.major }}'
echo 'minor: ${{ steps.semver_parser.outputs.minor }}'
echo 'patch: ${{ steps.semver_parser.outputs.patch }}'
echo 'feature (is pre-release?): ${{ steps.semver_parser.outputs.prerelease }}'
echo 'feature ver: ${{ steps.semver_parser.outputs.build }}'
echo 'full: ${{ steps.semver_parser.outputs.fullversion }}'
echo 'is pre-release: ${{ steps.semver_parser.outputs.prerelease != 0 }}'
- name: Download Release Artifact
uses: actions/[email protected]
with:
name: Release

- name: Download Debug Artifact
uses: actions/[email protected]
with:
name: Debug

- name: Automatic Releases
if: ${{ github.event_name == 'push' }}
uses: marvinpinto/action-automatic-releases@latest
uses: marvinpinto/action-automatic-releases@526ce12c6675bbe6e0e9a4169c90d09a3f7ad3e2
id: "automatic_releases"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest-debug"
prerelease: true
title: "Debug Build"
prerelease: ${{ steps.semver_parser.outputs.prerelease != 0 }}
files: |
Release_${{ github.sha }}.zip
Debug_${{ github.sha }}.zip
Notification:
if: ${{ github.event_name == 'push' && github.repository == 'BitCrackers/AmongUsMenu' }}
runs-on: ubuntu-latest
needs: [Release, Debug]
needs: [AutoRelease]
steps:
- name: Parse tag into env
# credit: mcraiha via [https://github.community/t/how-to-get-just-the-tag-name/16241/17]
id: get_tag
shell: bash
run: echo ::set-output name=THIS_TAG::${GITHUB_REF/refs\/tags\//}

- name: Debug tag parsing
run: echo '${{ steps.get_tag.outputs.THIS_TAG }}'

- name: Discord Notification
uses: rjstone/[email protected]
with:
severity: info
description: "Project Build"
details: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# note: we could also link directly to the asset, but that might not be very user-friendly
details: "${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.get_tag.outputs.THIS_TAG }}"
webhookUrl: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
2 changes: 1 addition & 1 deletion user/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <sstream>
#include "gitparams.h"

// test 'feature/automatic-releases'
// test autoRelease main ver increment

HMODULE hModule;
HANDLE hUnloadEvent;
Expand Down

0 comments on commit feca973

Please sign in to comment.