Skip to content

Commit

Permalink
👭 merge pull request #71 from FWDekker/obs~
Browse files Browse the repository at this point in the history
👭 mommy publishes to a debian repo~
  • Loading branch information
FWDekker authored Nov 28, 2023
2 parents d78df5c + 17f9d34 commit 9b85100
Show file tree
Hide file tree
Showing 8 changed files with 286 additions and 185 deletions.
89 changes: 70 additions & 19 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: CD

on:
push:
branches:
- main
branches: [ main ]
workflow_dispatch:

permissions:
Expand All @@ -12,13 +11,14 @@ permissions:

jobs:
check-release-needed:
# Note that `workflow_dispatch` is never skipped
# 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:
- name: nop
run: true


build-linux:
needs: [ check-release-needed ]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -55,34 +55,36 @@ jobs:

build-freebsd:
needs: [ check-release-needed ]
runs-on: macos-12
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install fpm && Build package
uses: vmactions/freebsd-vm@v0
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
set -e
echo "::group::Install basic packages"
pkg install -y git gmake || exit 1
pkg install -y git gmake
echo "::endgroup::"
# fpm
echo "::group::Install fpm: Actually install fpm"
pkg install -y devel/ruby-gems || exit 1
gem install --no-document fpm || exit 1
pkg install -y devel/ruby-gems
gem install --no-document fpm
echo "::endgroup::"
echo "::group::Install fpm: Install gtar (workaround for https://github.com/jordansissel/fpm/pull/1922)"
pkg install -y gtar || exit 1
mv /usr/bin/tar /usr/bin/bsdtar || exit 1
mv /usr/local/bin/gtar /usr/bin/tar || exit 1
pkg install -y gtar
mv /usr/bin/tar /usr/bin/bsdtar
mv /usr/local/bin/gtar /usr/bin/tar
echo "::endgroup::"
# /fpm
echo "::group::Ignore ownership issues"
git config --global --add safe.directory "$GITHUB_WORKSPACE" || exit 1
git config --global --add safe.directory "$GITHUB_WORKSPACE"
echo "::endgroup::"
run: |
set -e
Expand All @@ -106,23 +108,24 @@ jobs:
usesh: true
prepare: |
set -e
export PATH="/usr/sbin:$PATH" # Add 'pkg_*' commands to path
echo "::group::Install basic packages"
pkg_add git gmake mozilla-rootcerts-openssl || exit 1
pkg_add git gmake mozilla-rootcerts-openssl
echo "::endgroup::"
echo "::group::Install fpm"
pkg_add ruby
/usr/pkg/bin/gem install --no-document fpm
pkg_add pkg_install # This is necessary to make `fpm` work with `pkgin` format for some reason
pkg_add pkg_install # This is necessary to make 'fpm' work with 'pkgin' format for some reason
echo "::endgroup::"
echo "::group::Ignore ownership issues"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
echo "::endgroup::"
run: |
set -e
export PATH="/usr/sbin:$PATH" # Add `pkg_*` commands to path
export PATH="/usr/sbin:$PATH" # Add 'pkg_*' commands to path
gmake dist/netbsd
- name: Upload built package
Expand All @@ -133,12 +136,12 @@ jobs:

build-openbsd:
needs: [ check-release-needed ]
runs-on: macos-12
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install fpm && Build package
uses: vmactions/openbsd-vm@v0
uses: vmactions/openbsd-vm@v1
with:
usesh: true
prepare: |
Expand All @@ -151,7 +154,7 @@ jobs:
echo "::group::Install fpm"
pkg_add "$(pkg_info -Q ruby | grep "^ruby-[0-9]" | tail -n 1)"
/usr/local/bin/gem* install --no-document fpm
ln -s /usr/local/bin/fpm* /usr/local/bin/fpm # Symlink `fpm` to latest version
ln -s /usr/local/bin/fpm* /usr/local/bin/fpm # Symlink 'fpm' to latest version
echo "::endgroup::"
echo "::group::Ignore ownership issues"
Expand Down Expand Up @@ -196,6 +199,55 @@ jobs:
body_path: RELEASE_NOTES.md
files: mommy*

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
- name: Checkout apt-mommy
uses: actions/checkout@v4
with:
repository: fwdekker/apt-mommy
token: ${{ secrets.personal_access_token }}
- name: Extract version number
run: echo "MOMMY_VERSION=v$(head -n 1 ./mommy/version)" >> $GITHUB_ENV
- 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
run: |
echo "::group::Copy .deb into apt-mommy"
cp *.deb apt-mommy/deb/
echo "::endgroup::"
echo "::group::Update repo"
cd apt-mommy/
./update.sh
cd ../
echo "::endgroup::"
echo "::group::Commit update"
cd apt-mommy/
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::"
release-aur:
needs: [ release-mommy ]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -264,7 +316,6 @@ jobs:
sudo -u build git push origin master dev
echo "::endgroup::"
release-homebrew:
needs: [ release-mommy ]
runs-on: ubuntu-latest
Expand Down
Loading

0 comments on commit 9b85100

Please sign in to comment.