Skip to content

Commit 2946125

Browse files
authored
Merge pull request #5 from firehol/test
Replace Travis with Github actions
2 parents 46253bf + 9dc3398 commit 2946125

File tree

7 files changed

+92
-128
lines changed

7 files changed

+92
-128
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
set -e
4+
set -x
5+
6+
if [ "$SSH_AGENT_PID" ]
7+
then
8+
if [ ! -d $HOME/.ssh ]
9+
then
10+
mkdir -p $HOME/.ssh
11+
chmod 700 $HOME/.ssh
12+
touch $HOME/.ssh/config
13+
chmod 644 $HOME/.ssh/config
14+
fi
15+
echo PasswordAuthentication=no >> $HOME/.ssh/config
16+
else
17+
echo "No authentication agent; skipping deployment"
18+
fi
19+
20+
test -d output && mv output "$1"
21+
sed -e "s/NAME/website/" nginx.conf > "$1".conf
22+
23+
ssh-keyscan -H firehol.org >> ~/.ssh/known_hosts
24+
25+
ssh [email protected] mkdir -p "website/$1/"
26+
rsync -a "$1" "$1.conf" [email protected]:"website/$1/"
27+
ssh [email protected] touch "website/$1/complete.txt"

.github/workflows/publish.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
on: [ push, pull_request, workflow_dispatch ]
2+
3+
jobs:
4+
publish:
5+
runs-on: ubuntu-latest
6+
name: Publish Website
7+
steps:
8+
- name: Extract tag/branch variables
9+
shell: bash
10+
run: >
11+
echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/}|grep -v '/')";
12+
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/}|grep -v '/')";
13+
id: extract
14+
- name: Write secret keys
15+
run: >
16+
echo "$FIREHOL_ORG_PUBLISH_SSH" > firehol_org_publish_key;
17+
chmod 600 firehol_org_publish_key;
18+
if [ -s firehol_org_publish_key ];
19+
then
20+
eval "$(ssh-agent)";
21+
ssh-add firehol_org_publish_key;
22+
echo "##[set-output name=has_ssh_key;]true";
23+
echo "##[set-output name=ssh_agent_pid;]$SSH_AGENT_PID";
24+
echo "##[set-output name=ssh_auth_sock;]$SSH_AUTH_SOCK";
25+
fi;
26+
rm -f firehol_org_publish_key
27+
env:
28+
FIREHOL_ORG_PUBLISH_SSH: ${{secrets.FIREHOL_ORG_PUBLISH_SSH}}
29+
id: secret_keys
30+
- name: Skip branches which use a name reserved for use on the server
31+
if: >-
32+
${{ steps.extract.outputs.branch == ''
33+
|| steps.extract.outputs.branch == 'www'
34+
|| steps.extract.outputs.branch == 'download'
35+
|| steps.extract.outputs.branch == 'static'
36+
|| steps.extract.outputs.branch == 'ssl'
37+
|| steps.extract.outputs.branch == 'webalizer'
38+
|| steps.extract.outputs.branch == 'tmp' }}
39+
run: >
40+
echo "Not publishing '${{steps.extract.outputs.branch}}'";
41+
echo "##[set-output name=skip;]true"
42+
id: check
43+
- uses: actions/checkout@v2
44+
- run: ./.github/workflows/setup.sh
45+
- run: make
46+
- name: Deploy website ${{steps.extract.outputs.branch}}
47+
if: ${{ steps.secret_keys.outputs.has_ssh_key && ! steps.check.outputs.skip }}
48+
run: ./.github/workflows/deploy-website.sh ${{steps.extract.outputs.branch}}
49+
env:
50+
SSH_AGENT_PID: ${{ steps.secret_keys.outputs.ssh_agent_pid }}
51+
SSH_AUTH_SOCK: ${{ steps.secret_keys.outputs.ssh_auth_sock }}
52+
- name: Check deployment
53+
if: ${{ steps.secret_keys.outputs.has_ssh_key && ! steps.check.outputs.skip }}
54+
run: >
55+
sleep 300;
56+
curl -q -o- https://firehol.org/travis-website.log

.github/workflows/setup.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
set -e
4+
set -x
5+
6+
sudo apt install ruby pandoc
7+
sudo gem install cri -v 2.10.1
8+
sudo gem install nanoc --version 3.8.0
9+
sudo gem install pandoc-ruby nokogiri

.travis.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.travis/decrypt-if-have-key

Lines changed: 0 additions & 38 deletions
This file was deleted.

.travis/deploy-if-have-key

Lines changed: 0 additions & 39 deletions
This file was deleted.

.travis/secrets.tar.enc

-1.47 KB
Binary file not shown.

0 commit comments

Comments
 (0)