Skip to content

Commit 1531042

Browse files
committed
feat: using latest workflow
1 parent d7d7ad7 commit 1531042

File tree

1 file changed

+40
-74
lines changed

1 file changed

+40
-74
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,40 @@ on:
77
- '*'
88
env:
99
CACHE_REGISTRY: ghcr.io
10-
CACHE_REPO: redkubes/otomi-core
11-
REPO: otomi/core
12-
GIT_USER: redkubesbot
10+
CACHE_REPO: linode/apl-core
11+
REPO: linode/apl-core
12+
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_LINODEBOT_TOKEN }}
13+
DOCKER_USERNAME: ${{ vars.DOCKERHUB_LINODEBOT_USERNAME }}
1314

1415
jobs:
1516
build-test-cache:
1617
if: (!contains(github.event.head_commit.message, 'ci skip') && !startsWith(github.ref, 'refs/tags/') && !github.event.act)
1718
runs-on: ubuntu-latest
1819
env:
1920
COMMIT_MSG: ${{ github.event.head_commit.message }}
21+
BOT_EMAIL: ${{ vars.BOT_EMAIL }}
22+
BOT_USERNAME: ${{ vars.BOT_USERNAME }}
2023
steps:
2124
- name: Set env
2225
run: |
2326
tag=${GITHUB_REF##*/}
2427
echo "Creating tag: $tag"
2528
echo "TAG=$tag" >> $GITHUB_ENV
26-
git config --global user.email [email protected]
27-
git config --global user.name $GIT_USER
29+
git config --global user.email $BOT_EMAIL
30+
git config --global user.name $BOT_USERNAME
31+
2832
- name: Checkout
29-
uses: actions/checkout@v3
30-
# - name: CI tests, image build and push tag for main or branch
31-
# uses: whoan/docker-build-with-cache-action@v5
32-
# with:
33-
# username: ${{ env.GIT_USER }}
34-
# password: '${{ secrets.NPM_TOKEN }}'
35-
# registry: ${{ env.CACHE_REGISTRY }}
36-
# image_name: ${{ env.CACHE_REPO }}
37-
# image_tag: ${{ env.TAG }}
38-
# pull_image_and_stages: true
33+
uses: actions/checkout@v4
3934
- name: Set up Docker Buildx
40-
uses: docker/setup-buildx-action@v2
35+
uses: docker/setup-buildx-action@v3
4136
- name: Login to Github Packages
42-
uses: docker/login-action@v2.1.0
37+
uses: docker/login-action@v3
4338
with:
4439
registry: ${{ env.CACHE_REGISTRY }}
45-
username: ${{ env.GIT_USER }}
46-
password: '${{ secrets.NPM_TOKEN }}'
40+
username: ${{ env.BOT_USERNAME }}
41+
password: '${{ secrets.BOT_TOKEN }}'
4742
- name: CI tests, image build and push tag for main or branch
48-
uses: docker/build-push-action@v3
43+
uses: docker/build-push-action@v5
4944
with:
5045
push: true
5146
tags: |
@@ -55,15 +50,19 @@ jobs:
5550
needs: build-test-cache
5651
if: always() && ((contains(needs.build-test-cache.result, 'success') && !contains(needs.integration.outputs.started, 'true')) || (contains(needs.integration.result, 'success'))) && !github.event.act
5752
runs-on: ubuntu-latest
53+
env:
54+
BOT_EMAIL: ${{ vars.BOT_EMAIL }}
55+
BOT_USERNAME: ${{ vars.BOT_USERNAME }}
5856
steps:
5957
- name: Push to docker hub
6058
run: |
59+
set -u
6160
TAG=${GITHUB_REF##*/}
62-
docker login -u $GIT_USER -p '${{ secrets.NPM_TOKEN }}' ghcr.io
61+
docker login ghcr.io -u $BOT_USERNAME -p ${{ secrets.BOT_TOKEN }}
6362
image="$CACHE_REGISTRY/$CACHE_REPO:$TAG"
6463
docker pull $image
6564
docker tag $image $REPO:$TAG
66-
docker login -u otomi -p ${{ secrets.DOCKERHUB_OTOMI_TOKEN }}
65+
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
6766
docker push $REPO:$TAG
6867
- name: Show me the logic
6968
run: |
@@ -77,16 +76,16 @@ jobs:
7776
COMMIT_MSG: ${{ github.event.head_commit.message }}
7877
steps:
7978
- name: Checkout
80-
uses: actions/checkout@v3
79+
uses: actions/checkout@v4
8180
- name: Set env
8281
run: |
83-
git config --global user.email $[email protected]
84-
git config --global user.name $GIT_USER
82+
git config --global user.email $BOT_EMAIL
83+
git config --global user.name $BOT_USERNAME
8584
- name: Create and push git tag
8685
id: git_tag
8786
run: |
8887
TAG=${GITHUB_REF##*/}
89-
docker login -u otomi -p ${{ secrets.DOCKERHUB_OTOMI_TOKEN }}
88+
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
9089
docker pull $REPO:$TAG
9190
docker tag $REPO:$TAG $REPO:latest
9291
docker push $REPO:latest
@@ -95,10 +94,10 @@ jobs:
9594
echo "Releasing $REPO:$release_tag"
9695
docker tag $REPO:$TAG $REPO:$release_tag
9796
docker push $REPO:$release_tag
98-
docker login -u $GIT_USER -p '${{ secrets.NPM_TOKEN }}' ghcr.io
97+
docker login -u $BOT_USERNAME -p '${{ secrets.BOT_TOKEN }}' ghcr.io
9998
docker tag $REPO:$TAG $CACHE_REGISTRY/$CACHE_REPO:$release_tag
10099
docker push $CACHE_REGISTRY/$CACHE_REPO:$release_tag
101-
echo "machine github.com login $GIT_USER password ${{ secrets.GIT_PASSWORD }}" > ~/.netrc
100+
echo "machine github.com login ${{ env.BOT_USERNAME }} password ${{ secrets.BOT_TOKEN }}" > ~/.netrc
102101
git tag -am "$COMMIT_MSG" $release_tag && git push --follow-tags
103102
#Cut the CHANGELOG.md file up to the first occurence of the "### \[[0-9]*" (meaning three #, a space,a square bracket and any number after it)
104103
sed -n '/### \[[0-9]*/q;p' CHANGELOG.md > NEW_CHANGELOG.md
@@ -116,16 +115,16 @@ jobs:
116115
if: always() && contains(needs.release.result, 'success') && !github.event.act
117116
runs-on: ubuntu-latest
118117
container:
119-
image: otomi/tools:v1.4.20
118+
image: linode/apl-tools:v2.4.0
120119
options: --user 0
121120
steps:
122121
- name: Checkout
123-
uses: actions/checkout@v3
122+
uses: actions/checkout@v4
124123
- name: Prepare chart
125124
id: prepare_chart
126125
run: |
127126
# Install and update helm repo
128-
helm repo add otomi https://otomi.io/otomi-core
127+
helm repo add apl https://linode.github.io/apl-core
129128
helm repo update
130129
131130
# Retrieve the app version from package.json
@@ -150,22 +149,22 @@ jobs:
150149
)
151150
152151
# Update Chart.yaml and values.yaml with the new app version
153-
sed -i "s/0.0.0-chart-version/$app_version/g" chart/otomi/Chart.yaml
154-
sed -i "s/APP_VERSION_PLACEHOLDER/v$app_version/g" chart/otomi/Chart.yaml
152+
sed -i "s/0.0.0-chart-version/$app_version/g" chart/apl/Chart.yaml
153+
sed -i "s/APP_VERSION_PLACEHOLDER/v$app_version/g" chart/apl/Chart.yaml
155154
156155
echo "Chart and values files updated successfully with version $app_version"
157156
158157
# Copy readme from repo into the charts and add tpl/chart-values.md
159-
cp README.md chart/otomi/
160-
printf "\n\n" >>chart/otomi/README.md
161-
cat tpl/chart-values.md >>chart/otomi/README.md
158+
cp README.md chart/apl/
159+
printf "\n\n" >>chart/apl/README.md
160+
cat tpl/chart-values.md >>chart/apl/README.md
162161
163162
# Generate schema
164-
npx js-yaml values-schema.yaml > chart/otomi/values.schema.json
163+
npx js-yaml values-schema.yaml > chart/apl/values.schema.json
165164
166165
# Set the global id for git as it seems needed by the next step when a custom image is used
167-
git config --global user.email $[email protected]
168-
git config --global user.name $GIT_USER
166+
git config --global user.email ${{ env.BOT_EMAIL }}
167+
git config --global user.name ${{ env.BOT_USERNAME }}
169168
- name: Create and publish otomi chart release
170169
id: chart_release
171170
uses: helm/[email protected]
@@ -194,7 +193,7 @@ jobs:
194193
- name: Pulling the helm chart
195194
run: |
196195
# Install and update helm repo
197-
helm repo add otomi https://otomi.io/otomi-core
196+
helm repo add apl https://linode.github.io/apl-core
198197
helm repo update
199198
200199
# Get latest version of otomi
@@ -225,7 +224,7 @@ jobs:
225224
region=nl-ams \
226225
project-id=${{ secrets.SCW_DEFAULT_PROJECT_ID }} \
227226
--wait
228-
echo "CLuster deployed successfully"
227+
echo "Cluster deployed successfully"
229228
- name: Installing new otomi release
230229
run: |
231230
# Get cluster ID and set env var
@@ -277,36 +276,3 @@ jobs:
277276
SLACK_ICON: https://github.com/redkubes.png?size=48
278277
SLACK_TITLE: CI run
279278
SLACK_USERNAME: RedKubesBot
280-
281-
execute-aws-marketplace:
282-
name: AWS Dispatch
283-
needs: chart-release
284-
if: always() && contains(needs.chart-release.result, 'success') && !github.event.act
285-
runs-on: ubuntu-latest
286-
steps:
287-
- uses: actions/github-script@v6
288-
with:
289-
github-token: ${{ secrets.ACTIONS_KEY }}
290-
script: |
291-
await github.rest.actions.createWorkflowDispatch({
292-
owner: 'redkubes',
293-
repo: 'aws-marketplace',
294-
workflow_id: 'deploy_release.yaml',
295-
ref: 'main'
296-
})
297-
execute-azure-marketplace:
298-
name: Azure Dispatch
299-
needs: chart-release
300-
if: always() && contains(needs.chart-release.result, 'success') && !github.event.act
301-
runs-on: ubuntu-latest
302-
steps:
303-
- uses: actions/github-script@v6
304-
with:
305-
github-token: ${{ secrets.ACTIONS_KEY }}
306-
script: |
307-
await github.rest.actions.createWorkflowDispatch({
308-
owner: 'redkubes',
309-
repo: 'azure-marketplace',
310-
workflow_id: 'deploy_release.yaml',
311-
ref: 'main'
312-
})

0 commit comments

Comments
 (0)