Skip to content

Commit db02cea

Browse files
authored
Rebuild images on schedule (#14)
1 parent ce5c4d8 commit db02cea

5 files changed

Lines changed: 66 additions & 3 deletions

File tree

.github/workflows/push.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Build images and push (on master branch or on schedule)
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
schedule:
8+
- cron: '0 0 * * 0'
9+
workflow_dispatch:
10+
11+
jobs:
12+
push:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@master
16+
- name: Run CI
17+
run: |
18+
echo ${{ secrets.DH_PW }} | docker login -u ${{ secrets.DH_USER }} --password-stdin
19+
docker build -t ppiper/node-browsers:latest .
20+
docker build -t ppiper/node-browsers:node12 node12
21+
docker push ppiper/node-browsers:latest
22+
docker push ppiper/node-browsers:node12

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Create new monthly Release (automated)
2+
3+
on:
4+
repository_dispatch:
5+
types: perform-release
6+
schedule:
7+
- cron: '0 0 1 * *'
8+
workflow_dispatch:
9+
10+
jobs:
11+
create-release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Prepare Release
16+
run: |
17+
CURRENT_VERSION_LONG=$(curl --silent "https://api.github.com/repos/SAP/devops-docker-node-browsers/releases" | jq -r '.[].tag_name' | head -n1)
18+
echo Current version: $CURRENT_VERSION_LONG
19+
CURRENT_VERSION=`echo $CURRENT_VERSION_LONG | cut -c 2- | cut -d. -f1`
20+
NEXT_VERSION=v$(expr $CURRENT_VERSION + 1)
21+
echo Next version: $NEXT_VERSION
22+
STATUS_CODE_FOR_NEXT_RELEASE=$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/SAP/devops-docker-node-browsers/releases/tags/$NEXT_VERSION")
23+
if [ "$STATUS_CODE_FOR_NEXT_RELEASE" != "404" ]; then
24+
echo "Planned next release version ($NEXT_VERSION) already exists, aborting process"
25+
exit 1
26+
fi
27+
echo "::set-env name=PIPER_version::$NEXT_VERSION"
28+
29+
- name: Build, test and push
30+
run: |
31+
echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USER }} --password-stdin
32+
docker build -t ppiper/node-browsers:${{ PIPER_version }} .
33+
docker build -t ppiper/node-browsers:${{ PIPER_version }}-node12 node12
34+
docker push ppiper/node-browsers:${{ PIPER_version }}
35+
docker push ppiper/node-browsers:${{ PIPER_version }}-node12
36+
37+
- uses: SAP/project-piper-action@master
38+
with:
39+
piper-version: latest
40+
command: githubPublishRelease
41+
flags: --token ${{ secrets.GITHUB_TOKEN }}

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
FROM node:10-buster
33

44
RUN apt-get update && \
5-
apt-get install -y chromium=80.0.3987.162-1~deb10u1 firefox-esr=68.7.0esr-1~deb10u1 xvfb libxi6 libgbm1 libgconf-2-4 openjdk-11-jre && \
6-
rm -rf /var/lib/apt/lists/* /var/cache/apt/* && \
5+
apt-get install -y chromium firefox-esr xvfb libxi6 libgbm1 libgconf-2-4 openjdk-11-jre && \
6+
rm -rf /var/lib/apt/lists/* /var/cache/apt/* && \
77
ln -s /usr/bin/chromium /usr/bin/google-chrome && \
88
npm config set @sap:registry https://npm.sap.com --global
99

node12/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM node:12-buster
22

33
RUN apt-get update && \
4-
apt-get install -y chromium=80.0.3987.162-1~deb10u1 firefox-esr=68.7.0esr-1~deb10u1 xvfb libxi6 libgbm1 libgconf-2-4 openjdk-11-jre && \
4+
apt-get install -y chromium firefox-esr xvfb libxi6 libgbm1 libgconf-2-4 openjdk-11-jre && \
55
rm -rf /var/lib/apt/lists/* /var/cache/apt/* && \
66
ln -s /usr/bin/chromium /usr/bin/google-chrome && \
77
npm config set @sap:registry https://npm.sap.com --global

0 commit comments

Comments
 (0)