2021-09-11 09:37:29 +00:00
|
|
|
# This is a basic workflow to help you get started with Actions
|
|
|
|
|
|
|
|
name: Update Repository
|
|
|
|
|
|
|
|
# Controls when the workflow will run
|
|
|
|
on:
|
2023-02-17 14:13:44 +00:00
|
|
|
#push:
|
2021-09-11 11:38:55 +00:00
|
|
|
# If the configuration has changed, this ensures we apply updates.
|
2023-02-17 14:13:44 +00:00
|
|
|
#branches: [ main ]
|
2021-09-11 09:37:29 +00:00
|
|
|
|
2021-09-11 11:38:55 +00:00
|
|
|
schedule:
|
|
|
|
# Upstream releases around once per month, so twice a week should be fine.
|
|
|
|
- cron: '23 14 * * mon,thu'
|
2021-09-11 09:37:29 +00:00
|
|
|
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
2023-02-17 14:13:44 +00:00
|
|
|
build-deb:
|
|
|
|
name: Build DEB Packages
|
2021-09-11 09:37:29 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-02-17 14:13:44 +00:00
|
|
|
- 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' \
|
2023-02-17 14:15:02 +00:00
|
|
|
"https://api.github.com/repos/tonarino/innernet/releases/latest" \
|
2023-02-17 14:13:44 +00:00
|
|
|
| jq -r '(.name + " " + .tarball_url)' \
|
|
|
|
| (
|
|
|
|
read release tarball_url
|
2023-02-17 14:17:10 +00:00
|
|
|
wget -O- "$tarball_url" | tar xz
|
2023-02-17 14:13:44 +00:00
|
|
|
echo "innernet_release=$release" >>"$GITHUB_OUTPUT"
|
|
|
|
)
|
|
|
|
|
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Install cargo-deb
|
|
|
|
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: -p client
|
|
|
|
|
|
|
|
- name: Build Server DEB
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: deb
|
|
|
|
args: -p server
|
2021-09-11 09:37:29 +00:00
|
|
|
|
2023-02-17 14:13:44 +00:00
|
|
|
- name: Upload DEBs
|
|
|
|
uses: actions/upload-artifact@v2
|
2021-09-11 09:37:29 +00:00
|
|
|
with:
|
2023-02-17 14:13:44 +00:00
|
|
|
name: deb-ubuntu-latest
|
|
|
|
path: 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
|
2021-09-11 09:37:29 +00:00
|
|
|
|
2021-09-11 10:32:50 +00:00
|
|
|
- name: Set up GPG keys
|
|
|
|
run: |
|
2021-09-11 11:16:10 +00:00
|
|
|
mkdir -p -m 0700 "$HOME/.gnupg"
|
2021-09-11 11:19:43 +00:00
|
|
|
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"
|
2021-09-11 11:06:31 +00:00
|
|
|
gpgconf --reload gpg-agent
|
2021-09-11 10:32:50 +00:00
|
|
|
echo "${{ secrets.GPG_SIGNING_KEY }}" | gpg --quiet --batch --yes --import
|
2021-09-11 11:21:31 +00:00
|
|
|
echo '${{ secrets.GPG_SIGNING_PASSPHRASE }}' | /usr/lib/gnupg/gpg-preset-passphrase --preset 57F0E65446A301CC19914FD61167922350A2D8B2
|
2023-02-17 14:13:44 +00:00
|
|
|
|
|
|
|
- name: Get artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: deb-ubuntu-latest
|
|
|
|
|
|
|
|
- name: Update Repository
|
2021-09-11 11:01:30 +00:00
|
|
|
run: ./addlatest
|
2021-09-11 09:37:29 +00:00
|
|
|
|
|
|
|
- name: Push changes
|
|
|
|
uses: ad-m/github-push-action@v0.6.0
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2021-09-11 09:51:17 +00:00
|
|
|
branch: ${{ github.ref }}
|