Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Attach files to release and upload to PPA | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Check tag name | |
run: | | |
tag="${{ github.ref_name }}" | |
echo "$tag" | grep -Pq "^v\d+\.\d+\.\d+$" || (echo "Error: Tag name '$tag' does not correct." && exit 1) | |
- name: 📥 Clone repository | |
uses: actions/[email protected] | |
- name: ⚙️ Install dependencies | |
# Temporary disable packages caching feature. | |
# uses: awalsh128/cache-apt-pkgs-action@latest | |
# with: | |
# packages: devscripts dput debhelper | |
# version: 1.0 | |
run: | | |
sudo apt install devscripts dput debhelper -y | |
- name: 🔐 Set up GPG key | |
run: | | |
echo "${{ secrets.PPA_GPG_KEY }}" | gpg --allow-secret-key-import --import --batch --yes | |
- name: 🛠️ Build .deb package | |
working-directory: ./dotload | |
run: | | |
export DEBEMAIL="[email protected]" | |
export DEBFULLNAME="Okinea Dev" | |
tag="${{ github.ref_name }}" | |
release_version=$(echo "$tag" | sed 's/v//g') | |
changes="You can view the changes at this link - https://github.com/okineadev/dotload/releases/tag/$tag" | |
key="-k2783259A7535F745" | |
# gpg_cmd="-p\"gpg --batch --passphrase ${{ secrets.PPA_GPG_KEY_PASSPHRASE }} --pinentry-mode loopback\"" | |
dch --create --distribution jammy --package dotload --newversion $release_version $changes | |
debuild --no-lintian -i -p"gpg --batch --passphrase ${{ secrets.PPA_GPG_KEY_PASSPHRASE }} --pinentry-mode loopback" $key | |
debuild --no-lintian -S -sa -p"gpg --batch --passphrase ${{ secrets.PPA_GPG_KEY_PASSPHRASE }} --pinentry-mode loopback" $key | |
- name: 🛠️ Build Snap package | |
run: | | |
sudo iptables -P FORWARD ACCEPT | |
sudo snap install snapcraft --classic | |
sudo snap install lxd | |
sudo usermod -a -G lxd $USER | |
sudo snap run lxd init --auto | |
sudo snap run lxd waitready | |
# Login | |
export SNAPCRAFT_STORE_CREDENTIALS="${{ secrets.SNAPCRAFT_CREDENTIALS }}" | |
tag="${{ github.ref_name }}" | |
release_version=$(echo "$tag" | sed 's/v//g') | |
# TODO: fix this crutch | |
sed -i "s/@@VERSION@@/$release_version/g" snap/snapcraft.yaml | |
# Build snap package | |
sg lxd -c 'export SNAPCRAFT_STORE_CREDENTIALS="${{ secrets.SNAPCRAFT_CREDENTIALS }}" && snap run snapcraft --verbose' | |
- name: 📦 Upload package to Ubuntu PPA | |
run: | | |
dput ppa:salumin/tools dotload_*_source.changes | |
- name: 📦 Upload package to Snap Store | |
run: | | |
snapcraft upload --release=stable dotload_*_all.snap | |
- name: ⬆️ Upload files to release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
dotload/bin/dotload | |
dotload_*.deb | |
dotload_*.snap | |
dotload_*.dsc | |
dotload_*.tar.xz |