Skip to content

Commit

Permalink
🚒 mommy fixes her apt repository release script~
Browse files Browse the repository at this point in the history
  • Loading branch information
FWDekker committed Nov 29, 2023
1 parent aba7ebd commit f9f68b1
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 57 deletions.
96 changes: 58 additions & 38 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: CD

on:
# 'push' creates a real release
push:
branches: [ main ]
# 'workflow_dispatch' does a dry run of the workflow
workflow_dispatch:

permissions:
Expand All @@ -11,7 +13,6 @@ permissions:

jobs:
check-release-needed:
# Note that 'workflow_dispatch' is never skipped
if: "!(contains(github.event.head_commit.message, '[cd skip]') || contains(github.event.head_commit.message, '[skip cd]'))"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -174,7 +175,6 @@ jobs:
release-mommy:
needs: [ build-linux, build-macos, build-freebsd, build-netbsd, build-openbsd ]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch'

steps:
- name: Checkout
Expand All @@ -190,63 +190,75 @@ jobs:
uses: ffurrer2/extract-release-notes@v1
with:
release_notes_file: RELEASE_NOTES.md
- 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
uses: softprops/action-gh-release@v1
if: github.event_name != 'workflow_dispatch'
with:
draft: false
prerelease: false
tag_name: ${{ env.MOMMY_VERSION }}
body_path: RELEASE_NOTES.md
files: mommy*
discussion_category_name: announcements

release-apt:
needs: [ release-mommy ]
runs-on: ubuntu-latest

steps:
- name: Download built packages
uses: actions/download-artifact@v3
with:
name: dist
- 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:
repository: fwdekker/apt-mommy
path: apt-mommy
ref: main
fetch-depth: 0
# Required to push '.deb' to repository
token: ${{ secrets.personal_access_token }}
- name: Extract version number
run: echo "MOMMY_VERSION=v$(head -n 1 ./mommy/version)" >> $GITHUB_ENV
- name: Download built packages
uses: actions/download-artifact@v3
with:
name: dist
path: dist-mommy
- name: Move .deb into apt-mommy
run: cp dist-mommy/*.deb apt-mommy/deb/

- name: Import GPG key
run: echo "$apt_gpg_private_key" | gpg --import
env:
apt_gpg_private_key: ${{ secrets.apt_gpg_private_key }}
- name: Update apt repository
- name: Update apt-mommy
working-directory: apt-mommy
run: |
echo "::group::Copy .deb into apt-mommy"
cp *.deb apt-mommy/deb/
echo "::endgroup::"
echo "::group::Update repo"
cd apt-mommy/
echo "::group::Run update script"
./update.sh
cd ../
echo "::endgroup::"
echo "::group::Commit update"
cd apt-mommy/
echo "::group::Commit changes"
git add --all
git config --global user.name "FWDekkerBot"
git config --global user.email "bot@fwdekker.com"
git commit -am "🔖 mommy added package mommy $MOMMY_VERSION~"
cd ../
echo "::endgroup::"
echo "::group::Push changes"
cd apt-mommy/
git push origin
cd ../
echo "::endgroup::"
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
echo "::group::Push changes"
git push origin
echo "::endgroup::"
else
echo "::group::Not pushing changes"
echo "::endgroup::"
fi;
release-aur:
needs: [ release-mommy ]
Expand All @@ -272,10 +284,9 @@ jobs:
- name: Checkout mommy
uses: actions/checkout@v4
with:
path: mommy
token: ${{ secrets.personal_access_token }}
path: src-mommy
- name: Extract version number
run: echo "MOMMY_VERSION=v$(head -n 1 ./mommy/version)" >> $GITHUB_ENV
run: echo "MOMMY_VERSION=v$(head -n 1 ./src-mommy/version)" >> $GITHUB_ENV

- name: Checkout aur-mommy
uses: actions/checkout@v4
Expand All @@ -289,7 +300,7 @@ jobs:
- name: Fix aur-mommy directory ownership
run: chown -R build:build ./aur-mommy/
- name: Update build files
working-directory: ./aur-mommy/
working-directory: aur-mommy
run: |
echo "::group::Fast-forward main"
sudo -u build git checkout dev
Expand All @@ -312,9 +323,14 @@ jobs:
sudo -u build git merge --commit master
echo "::endgroup::"
echo "::group::Push changes"
sudo -u build git push origin master dev
echo "::endgroup::"
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
echo "::group::Push changes"
sudo -u build git push origin master dev
echo "::endgroup::"
else
echo "::group::Not pushing changes"
echo "::endgroup::"
fi;
release-homebrew:
needs: [ release-mommy ]
Expand All @@ -324,10 +340,9 @@ jobs:
- name: Checkout mommy
uses: actions/checkout@v4
with:
path: mommy
token: ${{ secrets.personal_access_token }}
path: src-mommy
- name: Extract version number
run: echo "MOMMY_VERSION=v$(head -n 1 ./mommy/version)" >> $GITHUB_ENV
run: echo "MOMMY_VERSION=v$(head -n 1 ./src-mommy/version)" >> $GITHUB_ENV

- name: Checkout homebrew-mommy
uses: actions/checkout@v4
Expand All @@ -339,7 +354,7 @@ jobs:
# Required to trigger CI action when pushed
token: ${{ secrets.personal_access_token }}
- name: Update formula
working-directory: ./homebrew-mommy/
working-directory: homebrew-mommy
run: |
echo "::group::Fast-forward main"
git checkout dev
Expand All @@ -362,6 +377,11 @@ jobs:
git merge --commit main
echo "::endgroup::"
echo "::group::Push changes"
git push origin main dev
echo "::endgroup::"
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
echo "::group::Push changes"
git push origin main dev
echo "::endgroup::"
else
echo "::group::Not pushing changes"
echo "::endgroup::"
fi;
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,12 @@ jobs:
test-netbsd:
runs-on: macos-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Test script and package
uses: vmactions/netbsd-vm@v0
uses: vmactions/netbsd-vm@v1
with:
usesh: true
prepare: |
Expand Down Expand Up @@ -446,21 +446,21 @@ jobs:
gmake test
echo "::endgroup::"
echo "::group::Build package"
gmake dist/netbsd
echo "::endgroup::"
echo "::group::Install package"
pkg_add ./dist/mommy-*+netbsd.tgz
echo "::endgroup::"
echo "::group::Test package"
MOMMY_SYSTEM=1 gmake test
echo "::endgroup::"
echo "::group::Uninstall package"
pkg_delete mommy
echo "::endgroup::"
# echo "::group::Build package"
# gmake dist/netbsd
# echo "::endgroup::"
#
# echo "::group::Install package"
# pkg_add ./dist/mommy-*+netbsd.tgz
# echo "::endgroup::"
#
# echo "::group::Test package"
# MOMMY_SYSTEM=1 gmake test
# echo "::endgroup::"
#
# echo "::group::Uninstall package"
# pkg_delete mommy
# echo "::endgroup::"


test-openbsd:
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog
## [1.2.5] -- 2023-11-28
## [1.2.6] -- 2023-11-29
### fixed
* 🚒 mommy fixes her apt repository release script~ ([#73](https://github.com/FWDekker/mommy/issues/73))


## [1.2.5] -- 2023-11-29
### added
* 📈 mommy now explains how to integrate with nushell, thanks to [aemogie.](https://github.com/aemogie)~ ([#65](https://github.com/FWDekker/mommy/issues/65))

Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1.2.5
1.2.6
2023-11-29

0 comments on commit f9f68b1

Please sign in to comment.