Skip to content

Commit

Permalink
push the build to ghcr.io
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengYanJin committed Apr 5, 2024
1 parent 20e33ce commit 0a71faf
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 53 deletions.
75 changes: 33 additions & 42 deletions .github/workflows/build-push-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,39 @@ name: build, push to registry and tests
on:
push:
branches-ignore:
- 'development/**'
- "development/**"

env:
NAMESPACE: 'zenko-ui-dev'
REGISTRY: 'registry.scality.com'
NAMESPACE: "scality/zenko-ui/dev"
REGISTRY: "ghcr.io"

jobs:

oras:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Oras
run: |
curl -LO https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz
mkdir -p oras-install/
sudo tar -zxf oras_${ORAS_VERSION}_*.tar.gz -C /usr/local/bin oras
rm -rf oras_${ORAS_VERSION}_*.tar.gz oras-install/
env:
ORAS_VERSION: '0.12.0'

- name: Oras login
run: oras login --username "${LOGIN}" --password "${PASSWORD}" ${REGISTRY}
env:
LOGIN: '${{ secrets.REGISTRY_LOGIN }}'
PASSWORD: '${{ secrets.REGISTRY_PASSWORD }}'

- name: push nginx and runtime-app-configuration
run: |
oras push ${REGISTRY}/${NAMESPACE}/zenko-ui-config:${{ github.sha }} \
runtime-app-configuration.gotempl:application/zenko-ui-runtime-config-template+json \
nginx.conf.gotempl:text/nginx-conf-template
- name: Checkout
uses: actions/checkout@v2

- name: Install Oras
run: |
curl -LO https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz
mkdir -p oras-install/
sudo tar -zxf oras_${ORAS_VERSION}_*.tar.gz -C /usr/local/bin oras
rm -rf oras_${ORAS_VERSION}_*.tar.gz oras-install/
env:
ORAS_VERSION: "0.12.0"

- name: Oras login
run: oras login --username "${LOGIN}" --password "${PASSWORD}" ${REGISTRY}
env:
LOGIN: "${{ github.actor }}"
PASSWORD: "${{ github.token }}"

- name: push nginx and runtime-app-configuration
run: |
oras push ${REGISTRY}/${NAMESPACE}/zenko-ui-config:${{ github.sha }} \
runtime-app-configuration.gotempl:application/zenko-ui-runtime-config-template+json \
nginx.conf.gotempl:text/nginx-conf-template
build:
runs-on: ubuntu-20.04
Expand All @@ -50,25 +49,18 @@ jobs:

- uses: actions/[email protected]
with:
node-version: '16'
cache: 'npm'
node-version: "16"
cache: "npm"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Scality Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD}}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: install dependencies
run: npm config set unsafe-perm true && npm ci
Expand All @@ -82,8 +74,7 @@ jobs:
push: true
context: .
tags: |
ghcr.io/${{ github.repository }}/zenko-ui:${{ github.sha }}
${{env.REGISTRY}}/${{env.NAMESPACE}}/zenko-ui:${{ github.sha }}
${{env.REGISTRY}}/${{env.NAMESPACE}}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

Expand All @@ -93,8 +84,8 @@ jobs:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: '16'
cache: 'npm'
node-version: "16"
cache: "npm"
- name: install dependencies
run: npm config set unsafe-perm true && npm ci
- name: run eslint test
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
release:
types: [published]
env:
DEV_NAMESPACE: 'zenko-ui-dev'
PROD_NAMESPACE: 'zenko-ui'
REGISTRY: 'registry.scality.com'
CONFIG_IMAGE: 'zenko-ui-config'
UI_IMAGE: 'zenko-ui'
DEV_NAMESPACE: "scality/zenko-ui/dev"
PROD_NAMESPACE: "scality/zenko-ui"
REGISTRY: "ghcr.io"
CONFIG_IMAGE: "zenko-ui-config"
UI_IMAGE: "zenko-ui"

jobs:
retag-docker-image:
Expand All @@ -19,25 +19,25 @@ jobs:
uses: actions/[email protected]
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Registry
- name: Login to registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install Oras
run: |
curl -LO https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz
mkdir -p oras-install/
sudo tar -zxf oras_${ORAS_VERSION}_*.tar.gz -C /usr/local/bin oras
rm -rf oras_${ORAS_VERSION}_*.tar.gz oras-install/
env:
ORAS_VERSION: '0.12.0'
ORAS_VERSION: "0.12.0"
- name: Oras login
run: oras login --username "${LOGIN}" --password "${PASSWORD}" ${REGISTRY}
env:
LOGIN: '${{ secrets.REGISTRY_LOGIN }}'
PASSWORD: '${{ secrets.REGISTRY_PASSWORD }}'
LOGIN: "${{ github.actor }}"
PASSWORD: "${{ github.token }}"

- name: push nginx and runtime-app-configuration
run: |
Expand Down

0 comments on commit 0a71faf

Please sign in to comment.