Skip to content

Commit

Permalink
❤️ merge pull request #91 from FWDekker/dev~
Browse files Browse the repository at this point in the history
❤️ v1.3.0~ (attempt 2)
  • Loading branch information
FWDekker authored Jan 11, 2024
2 parents d3172ae + c512704 commit 1b2c2c4
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 37 deletions.
87 changes: 55 additions & 32 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,49 @@
name: CD
name: 🚚 deploy~

on:
# 'push' creates a real release
push:
branches: [ main ]
# 'workflow_dispatch' does a dry run of the workflow
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run'
type: boolean
default: true

permissions:
contents: write
discussions: write
packages: read

jobs:
check-release-needed:
pre-flight-checks:
if: "!(contains(github.event.head_commit.message, '[cd skip]') || contains(github.event.head_commit.message, '[skip cd]'))"
runs-on: ubuntu-latest

outputs:
MOMMY_VERSION: ${{ steps.mommy_version.outputs.MOMMY_VERSION }}

steps:
- name: nop
run: true
- name: Print inputs
run: |
echo "dry_run: ${{ github.event.inputs.dry_run }}"
- name: Checkout
uses: actions/checkout@v4
- name: Extract mommy's version number
id: mommy_version
run: |
MOMMY_VERSION="v$(head -n 1 ./version)"
echo "MOMMY_VERSION=$MOMMY_VERSION" >> "$GITHUB_ENV"
echo "MOMMY_VERSION=$MOMMY_VERSION" >> "$GITHUB_OUTPUT"
- name: Check if release already exists
# yes, you really do need to compare with a string, and no, using ! does not work~
if: ${{ github.event.inputs.dry_run == 'false' }}
# using `fetch-tags` option of `actions/checkout` does not work properly~
run: |
git fetch --prune --unshallow --tags
! git show-ref --tags "$MOMMY_VERSION" --quiet
build-linux:
needs: [ check-release-needed ]
needs: [ pre-flight-checks ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -40,7 +61,7 @@ jobs:
path: dist/mommy*

build-macos:
needs: [ check-release-needed ]
needs: [ pre-flight-checks ]
runs-on: macos-latest
steps:
- name: Checkout
Expand All @@ -56,7 +77,7 @@ jobs:
path: dist/mommy*

build-freebsd:
needs: [ check-release-needed ]
needs: [ pre-flight-checks ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -99,7 +120,7 @@ jobs:
path: dist/mommy*

build-netbsd:
needs: [ check-release-needed ]
needs: [ pre-flight-checks ]
runs-on: macos-12
steps:
- name: Checkout
Expand Down Expand Up @@ -137,7 +158,7 @@ jobs:
path: dist/mommy*

build-openbsd:
needs: [ check-release-needed ]
needs: [ pre-flight-checks ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -174,18 +195,19 @@ jobs:


release-mommy:
needs: [ build-linux, build-macos, build-freebsd, build-netbsd, build-openbsd ]
needs: [ pre-flight-checks, build-linux, build-macos, build-freebsd, build-netbsd, build-openbsd ]
runs-on: ubuntu-latest

env:
MOMMY_VERSION: ${{ needs.pre-flight-checks.outputs.MOMMY_VERSION }}

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download built packages
uses: actions/download-artifact@v3
with:
name: dist
- name: Extract version number
run: echo "MOMMY_VERSION=v$(head -n 1 ./version)" >> $GITHUB_ENV
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
Expand All @@ -194,9 +216,9 @@ jobs:
- name: Prepend release notes
run: |
echo -e "mommy can also be installed using a package manager. [check the readme for more info](https://github.com/FWDekker/mommy/tree/${MOMMY_VERSION}#-installation)~\n" | cat - RELEASE_NOTES.md | tee RELEASE_NOTES.md
- name: Checkout release
- name: Publish release
uses: softprops/action-gh-release@v1
if: github.event_name != 'workflow_dispatch'
if: ${{ github.event.inputs.dry_run == 'false' }}
with:
target_commitish: main
tag_name: ${{ env.MOMMY_VERSION }}
Expand All @@ -207,17 +229,17 @@ jobs:
discussion_category_name: announcements

release-apt:
needs: [ release-mommy ]
needs: [ pre-flight-checks, release-mommy ]
runs-on: ubuntu-latest

env:
MOMMY_VERSION: ${{ needs.pre-flight-checks.outputs.MOMMY_VERSION }}

steps:
- name: Checkout mommy
uses: actions/checkout@v4
with:
path: src-mommy
- name: Extract version number
run: echo "MOMMY_VERSION=v$(head -n 1 ./src-mommy/version)" >> $GITHUB_ENV

- name: Checkout apt-mommy
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -253,7 +275,7 @@ jobs:
git commit -m "🔖 mommy added package mommy $MOMMY_VERSION~"
echo "::endgroup::"
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
if [ "${{ github.event.inputs.dry_run }}" = "false" ]; then
echo "::group::Push changes"
git push origin
echo "::endgroup::"
Expand All @@ -263,10 +285,13 @@ jobs:
fi;
release-aur:
needs: [ release-mommy ]
needs: [ pre-flight-checks, release-mommy ]
runs-on: ubuntu-latest
container: archlinux:latest

env:
MOMMY_VERSION: ${{ needs.pre-flight-checks.outputs.MOMMY_VERSION }}

steps:
- name: Set up basic system
run: |
Expand All @@ -287,8 +312,6 @@ jobs:
uses: actions/checkout@v4
with:
path: src-mommy
- name: Extract version number
run: echo "MOMMY_VERSION=v$(head -n 1 ./src-mommy/version)" >> $GITHUB_ENV

- name: Checkout aur-mommy
uses: actions/checkout@v4
Expand Down Expand Up @@ -326,7 +349,7 @@ jobs:
sudo -u build git merge --commit master
echo "::endgroup::"
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
if [ "${{ github.event.inputs.dry_run }}" = "false" ]; then
echo "::group::Push changes"
sudo -u build git push origin master dev
echo "::endgroup::"
Expand All @@ -336,17 +359,17 @@ jobs:
fi;
release-homebrew:
needs: [ release-mommy ]
needs: [ pre-flight-checks, release-mommy ]
runs-on: ubuntu-latest

env:
MOMMY_VERSION: ${{ needs.pre-flight-checks.outputs.MOMMY_VERSION }}

steps:
- name: Checkout mommy
uses: actions/checkout@v4
with:
path: src-mommy
- name: Extract version number
run: echo "MOMMY_VERSION=v$(head -n 1 ./src-mommy/version)" >> $GITHUB_ENV

- name: Checkout homebrew-mommy
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -381,7 +404,7 @@ jobs:
git merge --commit main
echo "::endgroup::"
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
if [ "${{ github.event.inputs.dry_run }}" = "false" ]; then
echo "::group::Push changes"
git push origin main dev
echo "::endgroup::"
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: 🧪 ci~

on:
push:
Expand Down Expand Up @@ -429,7 +429,7 @@ jobs:
test-netbsd:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -474,6 +474,7 @@ jobs:
gmake test
echo "::endgroup::"
# Extra tests disabled until https://github.com/vmactions/netbsd-vm/issues/4 is fixed
# echo "::group::Build package"
# gmake dist/netbsd
# echo "::endgroup::"
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -742,12 +742,13 @@ users connect to the server, get the latest instructions, and their system build
### 📯 release
[`main`](https://github.com/FWDekker/mommy/tree/main) always contains the latest stable version.
every merge into `main` automatically build and releases a new version~
to release a new version, just use the [deploy action](https://github.com/FWDekker/mommy/actions/workflows/cd.yml),
which can be activated using a `workflow_dispatch` event~
<details>
<summary>release checklists</summary>
* **before merging into `main`**
* **before triggering deployment**
* update `version`~
* update all changelogs~
* update `CHANGELOG.md`~
Expand All @@ -761,7 +762,7 @@ every merge into `main` automatically build and releases a new version~
* update acknowledgements in `README.md`~
* update promotional images in `.github/img/`~
* **after merging into `main`**
* **after triggering deployment**
* a new github release is created automatically~
* [aur-mommy](https://github.com/FWDekker/aur-mommy/)
* updated automatically when `mommy` updates
Expand Down

0 comments on commit 1b2c2c4

Please sign in to comment.