Skip to content

Commit

Permalink
adjust workflow and fix namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
miko-ov committed Dec 15, 2023
1 parent 1487740 commit ff7a9df
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 28 deletions.
49 changes: 22 additions & 27 deletions .github/workflows/demo1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,6 @@ defaults:

jobs:

getReleaseVersion:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-latest-release.outputs.version }}

steps:
- name: Get latest release
id: get-latest-release
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const release = await github.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
});
core.setOutput('version', release.data.tag_name); // Set the output


helmTest:
runs-on: ubuntu-latest
steps:
Expand All @@ -53,12 +33,28 @@ jobs:
deploy:
needs: [helmTest, getReleaseVersion]
needs: [helmTest]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2


- name: Get latest release
id: get-latest-release
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const release = await github.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
});
return release.data.tag_name;
- name: Set ENV variable
run: echo "VERSION=${{ steps.get-latest-release.outputs.result }}" >> $GITHUB_ENV

- name: Install ArgoCD CLI if not exists
run: |
if ! command -v argocd &> /dev/null; then
Expand All @@ -70,16 +66,15 @@ jobs:
env:
ARGOCD_SERVER: ${{ secrets.ARGOCD_SERVER }}
ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_AUTH_TOKEN }}
latestRelease: ${{ needs.get-version.outputs.version }}
run: |
argocd app create pixelaw-core-demo1 \
argocd app create $PROJECTNAME-demo1 \
--repo https://pixelaw.github.io/core/ \
--path chart/ \
--revision 0.0.33 \
--helm-chart pixelaw-core \
--dest-namespace pixelaw-core-demo1 \
--revision ${VERSION:1} \
--helm-chart $PROJECTNAME \
--dest-namespace $PROJECTNAME-demo1 \
--dest-server https://kubernetes.default.svc \
--helm-set-string dockerImage=$REGISTRY/pixelaw-core:v0.0.33 \
--helm-set-string dockerImage=$REGISTRY/$PROJECTNAME:${VERSION} \
--upsert \
--server $ARGOCD_SERVER \
--auth-token $ARGOCD_AUTH_TOKEN
Expand Down
2 changes: 1 addition & 1 deletion chart/pixelaw-core/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
projectName: pixelaw-core-demo1
nameSpace: main
nameSpace: demo1
appType:
frontend: webapp
database: db
Expand Down

0 comments on commit ff7a9df

Please sign in to comment.