Skip to content

Update main.yml

Update main.yml #28

Workflow file for this run

# Runs tests and verifies that the package can be built.
name: Build
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [main]
paths-ignore:
- "**.md"
- "**.yml"
- "dists/**"
- "src/**"
pull_request:
branches: [main]
paths-ignore:
- "**.md"
- "**.yml"
- "dists/**"
- "src/**"
schedule:
- cron: "5 8 * * 0" # run 8:05 every Sunday
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
runs-on: ${{matrix.operating-system}}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-22.04, ubuntu-20.04]
# php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- 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: Dynamically set environment variable
run: |
sudo timedatectl set-timezone Asia/Ho_Chi_Minh
bash ci/environment.sh
env:
repository: ${{ github.repository }}
branch: ${{ github.ref_name }}
- name: Retrieve the secret, decode and import GPG key
run: |
echo "$GPG_KEY====" | tr -d '\n' | fold -w 4 | sed '$ d' | tr -d '\n' | fold -w 76 | base64 -di | gpg --batch --import || true
gpg --list-secret-keys --keyid-format=long
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
- name: Configure Git gpg
# if: false == true
run: |
git config commit.gpgsign true
git config user.signingkey $GPG_KEY_ID
git config --local user.email "$GIT_COMMITTER_EMAIL"
git config --local user.name "$GIT_COMMITTER_NAME"
git config --local pull.rebase true
env:
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
GIT_COMMITTER_NAME: ${{ github.repository_owner }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
- name: Installing build dependencies
if: true
run: bash ci/depends.sh
- name: Updating build information
if: true
run: bash ci/package_update.sh
- name: Building package binary
if: true
run: bash ci/build.sh
env:
BUILDPACKAGE_OPTS: --force-sign
DEB_SIGN_KEYID: ${{ secrets.GPG_KEY_ID }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
- name: Building package source
if: true
run: bash ci/build.sh
env:
BUILDPACKAGE_OPTS: --force-sign -S
DEB_SIGN_KEYID: ${{ secrets.GPG_KEY_ID }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
- name: Put package to Personal Package archives
if: true
run: bash ci/push_ppa.sh
- name: Push to repository
if: false
run: |
if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then
git add src/debian/changelog
git commit -m "Update packages from ${{ matrix.operating-system }} at $(date +'%d-%m-%y')" &&
# git push https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git ${{ github.ref_name }} ||
git push ||
git stash &&
git pull --rebase &&
git stash apply &&
# git push https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git ${{ github.ref_name }} || true
git push || true
fi