Skip to content

Commit 5268dca

Browse files
authored
Build image on github (#23)
1 parent 2dee083 commit 5268dca

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

.github/workflows/push.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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 1 * *'
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/cf-cli:latest .
20+
docker push ppiper/cf-cli:latest

.github/workflows/release.yml

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

0 commit comments

Comments
 (0)