Skip to content

Bump version to 1.4.5 #32

Bump version to 1.4.5

Bump version to 1.4.5 #32

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create Release Directory
run: mkdir -p release
- name: Build DEB Package
run: |
mkdir -p debbuild/DEBIAN
TAG=${GITHUB_REF#refs/tags/}
VERSION=${TAG#v}
cp srcenv debbuild
cp srcenv.1 debbuild
(
echo 'Package: srcenv'
echo 'Version: '$VERSION'-1'
echo 'Section: utils'
echo 'Priority: optional'
echo 'Architecture: all'
echo 'Depends: jq'
echo 'Maintainer: Jean-Philippe Leconte <[email protected]>'
echo 'Description: A cross-shell tool for sourcing POSIX compliant .env scripts'
echo 'Homepage: https://github.com/ins0mniaque/srcenv'
) | tee debbuild/DEBIAN/control
(
echo 'Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/'
echo 'Upstream-Name: srcenv'
echo 'Upstream-Contact: https://github.com/ins0mniaque/srcenv/issues'
echo 'Source: https://github.com/ins0mniaque/srcenv'
echo
echo 'Files: *'
echo 'Copyright: 2024 Jean-Philippe Leconte'
echo 'License: MIT'
echo
echo 'License: MIT'
sed 's/^/ /' LICENSE
) | tee debbuild/DEBIAN/copyright
dpkg-deb --build debbuild "release/srcenv_${VERSION}-1_all.deb"
- name: Build RPM Package
run: |
mkdir -p rpmbuild/BUILD
mkdir -p rpmbuild/BUILDROOT
mkdir -p rpmbuild/RPMS
mkdir -p rpmbuild/SOURCES
mkdir -p rpmbuild/SPECS
mkdir -p rpmbuild/SRPMS
TAG=${GITHUB_REF#refs/tags/}
URL="https://github.com/ins0mniaque/srcenv/archive/refs/tags/$TAG.tar.gz"
VERSION=${TAG#v}
curl -Ls "$URL" -o "rpmbuild/SOURCES/srcenv-$VERSION.tar.gz"
(
echo 'Name: srcenv'
echo 'Version: '$VERSION
echo 'Release: 1%{?dist}'
echo 'Summary: A cross-shell tool for sourcing POSIX compliant .env scripts'
echo 'BuildArch: noarch'
echo 'Requires: jq'
echo
echo 'License: MIT'
echo 'Source0: %{name}-%{version}.tar.gz'
echo
echo '%description'
echo 'A cross-shell tool for sourcing POSIX compliant .env scripts'
echo
echo '%prep'
echo '%setup -q'
echo
echo '%install'
echo 'rm -rf $RPM_BUILD_ROOT'
echo 'mkdir -p $RPM_BUILD_ROOT%{_bindir}'
echo 'mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1'
echo 'cp %{name} $RPM_BUILD_ROOT%{_bindir}'
echo 'cp %{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1'
echo
echo '%clean'
echo 'rm -rf $RPM_BUILD_ROOT'
echo
echo '%files'
echo '%{_bindir}/%{name}'
echo '%{_mandir}/man1/%{name}.1.gz'
) | tee rpmbuild/SPECS/srcenv.spec
rpmbuild --define "_topdir $PWD/rpmbuild" -ba rpmbuild/SPECS/srcenv.spec
cp "rpmbuild/RPMS/noarch/srcenv-$VERSION-1.noarch.rpm" release
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create --generate-notes "${GITHUB_REF#refs/tags/}" release/*
- name: Checkout Homebrew Formula
uses: actions/checkout@v4
with:
repository: ins0mniaque/homebrew-srcenv
token: ${{ secrets.HOMEBREW_TOKEN }}
path: homebrew-srcenv
- name: Update Homebrew Formula
run: |
TAG=${GITHUB_REF#refs/tags/}
URL="https://github.com/ins0mniaque/srcenv/archive/refs/tags/$TAG.tar.gz"
SHA256=$(curl -Ls "$URL" | shasum -a 256 | cut -c1-64)
VERSION=${TAG#v}
cd homebrew-srcenv
(
echo 'class Srcenv < Formula'
echo ' desc "Cross-shell tool for sourcing POSIX compliant .env scripts"'
echo ' homepage "https://github.com/ins0mniaque/srcenv"'
echo ' url "'$URL'"'
echo ' version "'$VERSION'"'
echo ' sha256 "'$SHA256'"'
echo ' license "MIT"'
echo
echo ' depends_on "jq"'
echo
echo ' def install'
echo ' bin.install "srcenv"'
echo ' man1.install "srcenv.1"'
echo ' end'
echo
echo ' test do'
echo ' expected_version = "srcenv #{version}"'
echo ' actual_version = shell_output("#{bin}/srcenv --version").strip'
echo ' assert_match expected_version, actual_version'
echo ' end'
echo 'end'
) | tee Formula/srcenv.rb
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
git add Formula/srcenv.rb
git commit -m "Bump srcenv to $VERSION"
git push