Compare commits
18 Commits
ac1849016d
...
3b60243670
| Author | SHA1 | Date |
|---|---|---|
|
|
3b60243670 | |
|
|
40267968d6 | |
|
|
682a8337f3 | |
|
|
f97ad87d70 | |
|
|
7d6b234e8f | |
|
|
4bc862a047 | |
|
|
789aa3b79a | |
|
|
ea53ea31bb | |
|
|
e015dda3a4 | |
|
|
b97c67ba4a | |
|
|
ae478fda9d | |
|
|
bd877ba9e4 | |
|
|
a155d9199a | |
|
|
33b314a081 | |
|
|
7b7b8a6644 | |
|
|
1049c4e0e4 | |
|
|
9249435290 | |
|
|
8e762f3965 |
|
|
@ -0,0 +1,42 @@
|
||||||
|
name: Build Docker Image for Actions
|
||||||
|
on: [push]
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
jobs:
|
||||||
|
Check-If-Rebuild:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
env:
|
||||||
|
DEBIAN_FRONTEND: noninteractive
|
||||||
|
outputs:
|
||||||
|
last-time: ${{ steps.last-time.outputs.last-time }}
|
||||||
|
dockerfile-changed: ${{ steps.dockerfile-changed.outputs.dockerfile-changed }}
|
||||||
|
steps:
|
||||||
|
- name: Install jq
|
||||||
|
run: |
|
||||||
|
apt-get update -y
|
||||||
|
apt-get install -y jq
|
||||||
|
- name: Check last repository build time
|
||||||
|
id: last-time
|
||||||
|
run: curl -s https://hub.docker.com/v2/repositories/drunkendog/standard-build-actions/tags/latest
|
||||||
|
| jq '.last_updated'
|
||||||
|
| xargs -i date --date {} +%s
|
||||||
|
| xargs -i expr $(date +%s) - {}
|
||||||
|
| xargs -i echo last-time={} >> $GITHUB_OUTPUT
|
||||||
|
- name: Check if Dockerfile changed
|
||||||
|
id: dockerfile-changed
|
||||||
|
run: |
|
||||||
|
if ${{ github.event_name == 'pull_request' }}; then
|
||||||
|
echo dockerfile-changed=$(git diff --name-only -r HEAD^1 HEAD | grep -x actions/Dockerfile | wc -l) >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo dockerfile-changed=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep -x actions/Dockerfile | wc -l) >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
Build-Image:
|
||||||
|
needs: [Check-If-Rebuild]
|
||||||
|
if: needs.Check-If-Rebuild.outputs.last-time > 86400 || needs.Check-If-Rebuild.outputs.dockerfile-changed == 1
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Get Docker
|
||||||
|
run: curl -sL get.docker.io | bash
|
||||||
|
- name: Build and upload image
|
||||||
|
run: sh actions/build-docker-image.sh ${{ secrets.DOCKER_USERNAME }} ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
name: Code Quality Test
|
|
||||||
on: [push, pull_request]
|
|
||||||
jobs:
|
|
||||||
Quality-Check:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Check for os.system (#2)
|
|
||||||
continue-on-error: true
|
|
||||||
run: |
|
|
||||||
git ls-files | xargs grep os.system
|
|
||||||
exit $(git ls-files | xargs grep os.system | wc -l)
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
name: Code Quality Test
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
Quality-Check:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Check for --prefix in Borg commands (\#1)
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
git ls-files backup/ | xargs grep '\-\-prefix'
|
||||||
|
exit $(git ls-files backup/ | xargs grep '\-\-prefix' | wc -l)
|
||||||
|
- name: Check for os.system (\#2)
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
git ls-files | xargs grep os.system
|
||||||
|
exit $(git ls-files | xargs grep os.system | wc -l)
|
||||||
|
|
@ -11,9 +11,8 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
sh setup.sh
|
sh setup.sh
|
||||||
sh scripts/get-docker.sh
|
sh scripts/get-docker.sh
|
||||||
|
sh post-pull.sh
|
||||||
- name: Check if Docker was installed
|
- name: Check if Docker was installed
|
||||||
run: docker run --name hello-world hello-world
|
run: docker run --rm --name hello-world hello-world
|
||||||
- name: Clean up hello-world container
|
- name: Clean up network (see \#3)
|
||||||
run: docker rm hello-world
|
|
||||||
- name: Clean up network (see #3)
|
|
||||||
run: docker network rm main_subnet
|
run: docker network rm main_subnet
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
FROM ubuntu-22.04
|
FROM ubuntu:22.04
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y ca-certificates curl gnupg lsb-release nano wget tmux htop python3 python3-pip git certbot borgbackup jq
|
RUN apt-get update -y && apt-get install -y ca-certificates curl gnupg lsb-release nano wget tmux htop python3 python3-pip git certbot borgbackup jq nodejs && rm -rf /var/lib/apt/lists/*
|
||||||
CMD ["/bin/bash"]
|
CMD ["/bin/bash"]
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd "${0%/*}"
|
||||||
|
|
||||||
|
docker login --username $1 --password $2
|
||||||
|
docker build -t drunkendog/standard-build-actions .
|
||||||
|
docker push drunkendog/standard-build-actions
|
||||||
Loading…
Reference in New Issue