innernet-debian/.github/workflows/main.yml

102 lines
3.1 KiB
YAML

name: Update Repository
# Controls when the workflow will run
on:
#push:
# If the configuration has changed, this ensures we apply updates.
#branches: [ main ]
schedule:
# Upstream releases around once per month, so twice a week should be fine.
- cron: '23 14 * * mon,thu'
workflow_dispatch:
jobs:
build-deb:
name: Build DEB Packages
runs-on: ubuntu-latest
steps:
- name: Install Distro Dependencies
run: sudo env DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes dpkg-dev liblzma-dev
- name: Download Latest Release
id: download-release
run: |
wget -O- \
-H'Accept: application/json' \
"https://api.github.com/repos/tonarino/innernet/releases/latest" \
| jq -r '(.name + " " + .tarball_url)' \
| (
read release tarball_url
wget -O- "$tarball_url" | tar xz
echo "innernet_release=$release" >>"$GITHUB_OUTPUT"
mv tonarino-innernet-* tonarino-innernet
)
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install cargo-deb
working-directory: ./tonarino-innernet
run: |
type -p cargo-deb || cargo install cargo-deb
- name: Set up Rust Cache
uses: Swatinem/rust-cache@v1
- name: Build Client DEB
uses: actions-rs/cargo@v1
with:
command: deb
args: --manifest-path tonarino-innernet/Cargo.toml -p client
- name: Build Server DEB
uses: actions-rs/cargo@v1
with:
command: deb
args: --manifest-path tonarino-innernet/Cargo.toml -p server
- name: Upload DEBs
uses: actions/upload-artifact@v2
with:
name: deb-ubuntu-latest
path: tonarino-innernet/target/debian/*.deb
release:
runs-on: ubuntu-latest
needs: [build-deb]
steps:
- name: Install Distro Dependencies
run: sudo env DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes gpg jq reprepro
- name: Set up GPG keys
run: |
mkdir -p -m 0700 "$HOME/.gnupg"
echo 'pinentry-mode loopback' >>"$HOME/.gnupg/gpg.conf"
echo 'allow-loopback-pinentry' >>"$HOME/.gnupg/gpg-agent.conf"
echo 'allow-preset-passphrase' >>"$HOME/.gnupg/gpg-agent.conf"
gpgconf --reload gpg-agent
echo "${{ secrets.GPG_SIGNING_KEY }}" | gpg --quiet --batch --yes --import
echo '${{ secrets.GPG_SIGNING_PASSPHRASE }}' | /usr/lib/gnupg/gpg-preset-passphrase --preset 57F0E65446A301CC19914FD61167922350A2D8B2
- name: Get artifacts
uses: actions/download-artifact@v2
with:
name: deb-ubuntu-latest
- name: Update Repository
run: ./addlatest
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}