Skip to content

1.6.1

1.6.1 #23

Workflow file for this run

name: Build and Release Packages
on:
release:
types: [published]
permissions:
contents: write
env:
TOOL: ${{ github.event.repository.name }}
TOOL_PATH: ${{ github.event.repository.name }}
DESC: shell plugin manager teleporter
VERSION: ${{ github.event.release.tag_name }}
FPM_BASE: >
-a all -s dir
--license=MIT
--maintainer=${{ github.repository_owner }}
-m joknarf@free.fr
--vendor=https://joknarf.github.io/joknarf-tools
-n ${{ github.event.repository.name }}
--url=https://github.com/${{ github.repository }}
--vendor=https://joknarf.github.io/joknarf-tools
-v ${{ github.event.release.tag_name }}
jobs:
linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y ruby ruby-dev build-essential rpm
sudo gem install --no-document fpm
- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Build DEB
run: |
BUILD_EPOCH=$(date +%s)
fpm $FPM_BASE -t deb --prefix=/usr --description="$DESC" --deb-field "Build-Date:$BUILD_EPOCH" $TOOL_PATH=/bin/$TOOL
ln -s ${TOOL}_${VERSION}_all.deb $TOOL.deb
- name: Checkout deb
uses: actions/checkout@v3
with:
repository: joknarf/deb
token: ${{ secrets.JOKNARF_YUM_TOKEN }}
path: deb
- name: update deb repo
run: |
cp $TOOL.deb deb/pool/main
cd deb
git add pool/main/$TOOL.deb
git commit -m "Update $TOOL.deb to $VERSION" || echo "No changes to commit"
git push
env:
GITHUB_TOKEN: ${{ secrets.JOKNARF_YUM_TOKEN }}
- name: Build RPM
run: |
fpm $FPM_BASE -t rpm --prefix=/usr --description="$DESC" $TOOL_PATH=/bin/$TOOL
ln -s $TOOL-$VERSION-1.noarch.rpm $TOOL.rpm
- name: Checkout yum
uses: actions/checkout@v3
with:
repository: joknarf/yum
token: ${{ secrets.JOKNARF_YUM_TOKEN }}
path: yum
- name: update yum repo
run: |
cp $TOOL.rpm yum/
cd yum
git add $TOOL.rpm
git commit -m "Update $TOOL.rpm to $VERSION" || echo "No changes to commit"
git push
env:
GITHUB_TOKEN: ${{ secrets.JOKNARF_YUM_TOKEN }}
- name: Build TAR
run: |
fpm $FPM_BASE -t tar --prefix=$TOOL-$VERSION --description="$DESC" $TOOL_PATH=/bin/$TOOL && gzip *.tar
- name: Build ZIP
run: |
fpm $FPM_BASE -t zip --prefix=.local --description="$DESC" $TOOL_PATH=/bin/$TOOL
- name: URL and SHA256
run: |
URL="https://github.com/${{ github.repository }}/releases/download/${VERSION}/$TOOL.tar.gz"
echo "URL=$URL" >>$GITHUB_ENV
SHA256=$(shasum -a 256 $TOOL.tar.gz | awk '{print $1}')
echo "SHA256=$SHA256" >> $GITHUB_ENV
- name: Version URL SHA
run: |
echo "VERSION=$VERSION"
echo "URL=$URL"
echo "SHA256=$SHA256"
- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Checkout Homebrew tap
uses: actions/checkout@v3
with:
repository: joknarf/homebrew-tools
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: homebrew-tap
- name: Update formula
run: |
FORMULA_FILE=homebrew-tap/Formula/$TOOL.rb
sed -i "s|url \".*\"|url \"${URL}\"|" $FORMULA_FILE
sed -i "s|sha256 \".*\"|sha256 \"${SHA256}\"|" $FORMULA_FILE
sed -i "s|version \".*\"|version \"${VERSION}\"|" $FORMULA_FILE
- name: Commit & Push
run: |
cd homebrew-tap
git add Formula/$TOOL.rb
git commit -m "Update $TOOL formula to $VERSION" || echo "No changes to commit"
git push
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
*.deb
*.rpm
*.tar.gz
*.zip
alpine:
name: Alpine (apk)
runs-on: ubuntu-latest
container:
image: alpine:latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
apk add --no-cache ruby ruby-dev build-base apk-tools tar
gem install --no-document fpm
- name: Build APK
run: |
fpm $FPM_BASE -t apk --prefix=/usr --description="$DESC" $TOOL_PATH=/bin/$TOOL
ln -s ${TOOL}_${VERSION}_all.apk $TOOL.apk
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
*.apk
macos:
name: macOS (pkg)
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
brew install ruby
sudo gem install --no-document fpm
- name: Build PKG
run: |
fpm $FPM_BASE -t osxpkg --prefix=/ --description="$DESC" $TOOL_PATH=usr/local/bin/$TOOL
ln -s $TOOL-$VERSION.pkg $TOOL.pkg
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
*.pkg