Skip to content

Commit

Permalink
chore (actions): fixed workflow for debian build and deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Lukas committed Aug 11, 2021
1 parent 2b701dc commit 369bcef
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/act/push.json
@@ -0,0 +1,5 @@
{
"push": {
"ref": "refs/master"
}
}
5 changes: 5 additions & 0 deletions .github/act/tag.json
@@ -0,0 +1,5 @@
{
"push": {
"ref": "refs/tags/v.0.10.0"
}
}
7 changes: 7 additions & 0 deletions .github/scripts/decrypt_file.sh
@@ -0,0 +1,7 @@
#!/bin/sh
mkdir $HOME/secrets
# Decrypt the file
# --batch to prevent interactive command
# --yes to assume "yes" for questions
gpg --quiet --batch --yes --decrypt --passphrase="$FABSCAN_KEY_PASSPHRASE" \
--output $HOME/secrets/fabscan.key fabscan.key.gpg
22 changes: 16 additions & 6 deletions .github/workflows/build-package.yml
Expand Up @@ -6,7 +6,7 @@ jobs:
steps:
- name: 🏗 Install build dependencies
run: sudo apt-get -qq update
- run: sudo apt-get install python3.8 python3.8-dev python3-pip libcurl4 build-essential python3-tornado python3-setuptools debhelper dh-systemd cdbs dh-python fakeroot python3-pip rsync locales
- run: sudo apt-get -y install python3.8 python3.8-dev python3-pip libcurl4 build-essential python3-tornado python3-setuptools debhelper dh-systemd cdbs dh-python fakeroot python3-pip rsync locales
- run: pip3 install virtualenv
- name: 🏗 Create virtual python env
run: virtualenv -p /usr/bin/python3.8 hotspot-env
Expand All @@ -16,12 +16,22 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Add current Date to env vars
run: echo "CURRENT_DATE=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
- name: Add Version to env vars
run: echo "VERSION=$(head -1 debian/changelog | awk -F'[()]' '{print $2}')" >> $GITHUB_ENV
- name: Replace version Number for testing build
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: |
CURRENT_DATE=$(date +%Y%m%d%H%M) \
VERSION=$(head -1 debian/changelog | awk -F'[()]' '{print $2}') \
sed -i -e "s/$VERSION/$VERSION+$CURRENT_DATE/g" debian/changelog
shell: bash
run: sed -i -e "s/${{ env.VERSION }}/${{ env.VERSION }}+${{ env.CURRENT_DATE }}/g" debian/changelog
- name: 🔨 Build Debian package
run: sudo make deb
- name: Add Package Name to env var
run: echo "FILE_NAME=$(ls -a ../*.deb)" >> $GITHUB_ENV
- name: Decrypt fabscan key secret
run: ./.github/scripts/decrypt_file.sh
env:
FABSCAN_KEY_PASSPHRASE: ${{ secrets.FABSCAN_KEY_PASSPHRASE }}
- name: change keyfile permission
run: chmod 600 $HOME/secrets/fabscan.key
- name: deploy build artifact
run: LC_ALL=C scp -o StrictHostKeyChecking=no -i $HOME/secrets/fabscan.key ${{ env.FILE_NAME }} ${{ secrets.FABSCAN_DEPLOY_USER }}@mariolukas.de:/var/deploy/release/.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -68,3 +68,4 @@ docs/_build/
target/

.idea/
.github/act/my.secrets
Binary file removed fabscan.key.enc
Binary file not shown.
Binary file added fabscan.key.gpg
Binary file not shown.

0 comments on commit 369bcef

Please sign in to comment.