Skip to content
This repository was archived by the owner on Nov 12, 2022. It is now read-only.

Commit 689a10e

Browse files
ci: Docker image ref fixed (#10)
1 parent 84b1f89 commit 689a10e

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

.github/workflows/CI.yaml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,44 @@ jobs:
2424
test:
2525
name: Testing
2626
runs-on: ubuntu-latest
27+
outputs:
28+
tag: ${{ steps.info.outputs.tag }}
2729
steps:
2830
- name: Checkout Code
2931
uses: actions/checkout@v2
32+
- id: info
33+
run: |
34+
repo=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
35+
if [ -n $GITHUB_SHA ]
36+
then
37+
tag=$GITHUB_SHA
38+
elif [ -n $GITHUB_HEAD_REF ]
39+
then
40+
tag=$(echo $GITHUB_HEAD_REF | cut -f 3- -d "/")
41+
else
42+
tag=schedule
43+
fi
44+
tag=$tag
45+
echo "::set-output name=repo::$repo"
46+
echo "::set-output name=tag::$tag"
3047
- name: Build and Push to GitHub registry Commit tag
3148
uses: elgohr/Publish-Docker-Github-Action@master
3249
with:
3350
name: docker.pkg.github.com/${{ github.repository }}/jelastic-cli
3451
username: ${{ github.repository_owner }}
3552
password: ${{ secrets.G_TOKEN }}
3653
registry: docker.pkg.github.com
37-
tags: "${{ github.sha }}"
54+
tags: "${{ steps.info.outputs.tag }}"
3855
- name: Login to GitHub Packages Docker Registry
3956
uses: docker/login-action@v1
4057
with:
4158
registry: docker.pkg.github.com
4259
username: ${{ github.repository_owner }}
4360
password: ${{ secrets.G_TOKEN }}
44-
- id: repo
45-
run: |
46-
lower=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
47-
echo "::set-output name=lower::$lower"
4861
- name: Anchore scan
4962
uses: anchore/scan-action@v2
5063
with:
51-
image: "docker.pkg.github.com/${{ steps.repo.outputs.lower }}/jelastic-cli:${{ github.sha }}"
64+
image: "docker.pkg.github.com/${{ steps.info.outputs.repo }}/jelastic-cli:${{ steps.info.outputs.tag }}"
5265
fail-build: true
5366
acs-report-enable: true
5467
severity-cutoff: high
@@ -78,14 +91,14 @@ jobs:
7891
username: ${{ github.repository_owner }}
7992
password: ${{ secrets.G_TOKEN }}
8093
registry: docker.pkg.github.com
81-
tags: "${{ steps.create_tag_test.outputs.new_tag }},latest"
94+
tags: "${{ needs.test.outputs.tag }},${{ steps.create_tag_test.outputs.new_tag }},latest"
8295
- name: Build and Push to DockerHub
8396
uses: elgohr/Publish-Docker-Github-Action@master
8497
with:
8598
name: aliaksandrdounar/jelastic-cli
8699
username: ${{ secrets.DOCKER_USERNAME }}
87100
password: ${{ secrets.DOCKER_PASSWORD }}
88-
tags: "${{ github.sha }},${{ steps.create_tag_test.outputs.new_tag }},latest"
101+
tags: "${{ needs.test.outputs.tag }},${{ steps.create_tag_test.outputs.new_tag }},latest"
89102

90103
release:
91104
name: Create Release

0 commit comments

Comments
 (0)