Skip to content

Commit

Permalink
Merge pull request #36 from acend/fix-release-action
Browse files Browse the repository at this point in the history
try to fix the release action
  • Loading branch information
splattner authored Jan 11, 2022
2 parents b13f704 + 8644465 commit 869e249
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 5 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ jobs:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_TOKEN }}

-
name: Login to the ghcr.io Container registry
uses: docker/login-action@5fcefb941de79536616e9422226e33fd39f1706f
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

-
name: Build PR Version
uses: docker/build-push-action@v2
Expand All @@ -34,6 +43,7 @@ jobs:
push: true
tags: |
quay.io/acend/theia:pr-${{ github.event.pull_request.number }}
ghcr.io/acend/theia:pr-${{ github.event.pull_request.number }}
-
name: Run vulnerability scanner
uses: aquasecurity/trivy-action@master
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/pr-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,31 @@ jobs:
QUAYIO_API_TOKEN: '${{ secrets.QUAYIO_API_TOKEN }}'
run: |
curl -X DELETE -H "Authorization: Bearer ${QUAYIO_API_TOKEN}" https://quay.io/api/v1/repository/acend/theia/tag/pr-${PR_NUMBER}{,-puzzle}
-
name: Delete PR Tag on ghcr.io
env:
PR_NUMBER: '${{ github.event.pull_request.number }}'
REPOSITORY: '${{ github.repository }}'
run : |
ORG=$(echo $REPOSITORY | cut -d "/" -f1)
REPO=$(echo $REPOSITORY | cut -d "/" -f2)
for PACKAGE_VERSION_ID in $(curl -s -H "Authorization: Bearer ${{ secrets.GH_PAT_DELETE_PACKAGES }}" https://api.github.com/orgs/${ORG}/packages/container/${REPO}/versions | jq --arg PR pr-$PR_NUMBER '.[] | select (.metadata.container.tags[] | contains ($PR)) | .id')
do
echo "Delete package with id ${PACKAGE_VERSION_ID}"
curl -X DELETE -H "Authorization: Bearer ${{ secrets.GH_PAT_DELETE_PACKAGES }}" https://api.github.com/orgs/${ORG}/packages/container/${REPO}/versions/${PACKAGE_VERSION_ID}
done
-
name: Delete untagged on ghcr.io
env:
PR_NUMBER: '${{ github.event.pull_request.number }}'
REPOSITORY: '${{ github.repository }}'
run : |
ORG=$(echo $REPOSITORY | cut -d "/" -f1)
REPO=$(echo $REPOSITORY | cut -d "/" -f2)
for PACKAGE_VERSION_ID in $(curl -s -H "Authorization: Bearer ${{ secrets.GH_PAT_DELETE_PACKAGES }}" https://api.github.com/orgs/${ORG}/packages/container/${REPO}/versions | jq '.[] | select( (.metadata.container.tags | length) == 0) | .id')
do
echo "Delete untagged package with id ${PACKAGE_VERSION_ID}"
curl -X DELETE -H "Authorization: Bearer ${{ secrets.GH_PAT_DELETE_PACKAGES }}" https://api.github.com/orgs/${ORG}/packages/container/${REPO}/versions/${PACKAGE_VERSION_ID}
done
10 changes: 10 additions & 0 deletions .github/workflows/push-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ jobs:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_TOKEN }}

-
name: Log in to the ghcr.io Container registry
uses: docker/login-action@5fcefb941de79536616e9422226e33fd39f1706f
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

-
name: Build Latest Version
uses: docker/build-push-action@v2
Expand All @@ -60,6 +69,7 @@ jobs:
push: true
tags: |
quay.io/acend/theia:latest
ghcr.io/acend/theia:latest
-
name: Run vulnerability scanner
uses: aquasecurity/trivy-action@master
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Build & deploy Release Version

on:
push:
tags:
- 'webshell-*' # This is created when push on main when Helm Chart version was changed
release:
types: [published]

jobs:
build:
Expand All @@ -28,6 +27,14 @@ jobs:
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_TOKEN }}

-
name: Log in to the ghcr.io Container registry
uses: docker/login-action@5fcefb941de79536616e9422226e33fd39f1706f
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

-
name: Get the version # strip away "ref/tags/webshell-"
id: get_version
Expand All @@ -42,6 +49,7 @@ jobs:
push: true
tags: |
quay.io/acend/theia:${{ steps.get_version.outputs.VERSION }}
ghcr.io/acend/theia:${{ steps.get_version.outputs.VERSION }}
-
name: Run vulnerability scanner
uses: aquasecurity/trivy-action@master
Expand Down
4 changes: 2 additions & 2 deletions deploy/charts/webshell/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: webshell
description: A Helm chart to deploy a webshell environment
type: application
version: 0.1.13
appVersion: "0.1.13"
version: 0.1.14
appVersion: "0.1.14"

0 comments on commit 869e249

Please sign in to comment.