Update GitHub Actions workflow to use self-hosted runners #168
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: Build | |
on: | |
push: | |
branches: [main] | |
# paths: | |
# - "src/debian/changelog" | |
paths-ignore: | |
- "**/changelog" | |
- "**.md" | |
pull_request: | |
branches: [main] | |
# paths: | |
# - "src/debian/changelog" | |
paths-ignore: | |
- "**/changelog" | |
- "**.md" | |
workflow_dispatch: | |
jobs: | |
package-build: | |
runs-on: ${{matrix.operating-system}} | |
strategy: | |
fail-fast: false | |
matrix: | |
# operating-system: [ubuntu-22.04] | |
# operating-system: [ubuntu-22.04, ubuntu-20.04, ubuntu-latest, ubuntu-18.04] | |
operating-system: [self-hosted] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Create GPG key if not exists | |
# gpg --full-generate-key | |
# List to select GPG key | |
# gpg --list-secret-keys --keyid-format=long | |
# Example: rsa3072/7E0EC917A5074BD3 2023-03-13 [SC] [expires: 2025-03-12] | |
# Generate key as base64 | |
# gpg --export-secret-keys 3AA5C34371567BD2 | base64 | |
- name: Setup GPG | |
uses: diepxuan/.github/.github/actions/gpg-setup@main | |
with: | |
gpg_key: ${{ secrets.GPG_KEY }} | |
gpg_key_id: ${{ secrets.GPG_KEY_ID }} | |
committer_email: ${{ secrets.GIT_COMMITTER_EMAIL }} | |
committer_name: ${{ github.repository_owner }} | |
- name: SSH configuration | |
uses: diepxuan/.github/.github/actions/ssh-setup@main | |
with: | |
ssh_key_id: ${{ secrets.SSH_ID_RSA }} | |
- name: Package build | |
working-directory: src | |
shell: bash | |
run: | | |
sudo timedatectl set-timezone Asia/Ho_Chi_Minh | |
chmod +x build.sh | |
bash build.sh | |
env: | |
INPUT_APT_OPTS: | |
INPUT_EXTRA_BUILD_DEPS: | |
repository: ${{ github.repository }} | |
branch: ${{ github.ref_name }} | |
GIT_COMMITTER_MESSAGE: ${{ github.event.head_commit.message }} | |
DEBEMAIL: ductn@diepxuan.com | |
EMAIL: ductn@diepxuan.com | |
DEBFULLNAME: Tran Ngoc Duc | |
NAME: Tran Ngoc Duc | |
DEBIAN_FRONTEND: noninteractive | |
GPG_KEY: ${{ secrets.GPG_KEY }} | |
DEB_SIGN_KEYID: ${{ secrets.GPG_KEY_ID }} | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
- name: Push Changes to Github | |
shell: bash | |
env: | |
GIT_COMMITTER_MESSAGE: ${{ github.event.head_commit.message }} | |
run: | | |
if [ -n "$(git status $debian_dir --porcelain=v1 2>/dev/null)" ]; then | |
git add $debian_dir | |
git commit -m "Package Release $project-$release_tag in $DISTRIB~$RELEASE ($CODENAME)" | |
if ! git push; then | |
git stash | |
git pull --rebase | |
git stash pop | |
git push || true | |
fi | |
fi | |
package-publish: | |
needs: package-build | |
permissions: | |
contents: write | |
uses: diepxuan/.github/.github/workflows/debian-package-publish.yml@main | |
with: | |
message: ${{ github.event.head_commit.message }} | |
secrets: | |
GPG_KEY: ${{ secrets.GPG_KEY }} | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }} | |
SSH_ID_RSA: ${{ secrets.SSH_ID_RSA }} |