-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] Move CI from GitLab to GitHub (#147)
* [ci] Move CI from GitLab to GitHub * use ubuntu-latest runners * fix ref_name * take version from output * put version in env * try another format * fix set-variables * rm gitlab ci, add concurrency * add deploy * permissions * add envs * apps * app
- Loading branch information
Showing
6 changed files
with
176 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
IMAGE_NAME: paritytech/testnet-manager | ||
|
||
jobs: | ||
set-variables: | ||
name: Set variables | ||
runs-on: ubuntu-latest | ||
outputs: | ||
VERSION: ${{ steps.version.outputs.VERSION }} | ||
steps: | ||
- name: Define version | ||
id: version | ||
run: | | ||
export COMMIT_SHA=${{ github.sha }} | ||
export COMMIT_SHA_SHORT=${COMMIT_SHA:0:8} | ||
export REF_NAME=${{ github.ref_name }} | ||
export REF_SLUG=${REF_NAME//\//_} | ||
if [[ ${REF_SLUG} == "main" ]] | ||
then | ||
echo "VERSION=${REF_SLUG}-${COMMIT_SHA_SHORT}" >> $GITHUB_OUTPUT | ||
else | ||
echo "VERSION=${REF_SLUG}" >> $GITHUB_OUTPUT | ||
fi | ||
echo "set VERSION=${VERSION}" | ||
build_image: | ||
name: Build docker image | ||
runs-on: ubuntu-latest | ||
needs: [set-variables] | ||
env: | ||
VERSION: ${{ needs.set-variables.outputs.VERSION }} | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and push Docker image from main | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: false | ||
tags: | | ||
${{ env.IMAGE_NAME }}:${{ env.VERSION }} | ||
${{ env.IMAGE_NAME }}:latest |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
#to use reusable workflow | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
env: | ||
IMAGE_NAME: paritytech/testnet-manager | ||
APP: "testnet-manager" | ||
|
||
jobs: | ||
set-variables: | ||
name: Set variables | ||
runs-on: ubuntu-latest | ||
outputs: | ||
VERSION: ${{ steps.version.outputs.VERSION }} | ||
steps: | ||
- name: Define version | ||
id: version | ||
run: | | ||
export COMMIT_SHA=${{ github.sha }} | ||
export COMMIT_SHA_SHORT=${COMMIT_SHA:0:8} | ||
export REF_NAME=${{ github.ref_name }} | ||
export REF_SLUG=${REF_NAME//\//_} | ||
if [[ ${REF_SLUG} == "main" ]] | ||
then | ||
echo "VERSION=${REF_SLUG}-${COMMIT_SHA_SHORT}" >> $GITHUB_OUTPUT | ||
else | ||
echo "VERSION=${REF_SLUG}" >> $GITHUB_OUTPUT | ||
fi | ||
echo "set VERSION=${VERSION}" | ||
docker-publish: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
environment: main | ||
needs: [set-variables] | ||
env: | ||
VERSION: ${{ needs.set-variables.outputs.VERSION }} | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USER }} | ||
password: ${{ secrets.DOCKERHUB_PASS }} | ||
|
||
- name: Build and push Docker image from main | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: | | ||
${{ env.IMAGE_NAME }}:${{ env.VERSION }} | ||
${{ env.IMAGE_NAME }}:latest | ||
deploy-versi: | ||
name: Deploy Versi | ||
runs-on: ubuntu-latest | ||
environment: parity-versi | ||
needs: [set-variables, docker-publish] | ||
env: | ||
VERSION: ${{ needs.set-variables.outputs.VERSION }} | ||
ARGOCD_SERVER: "versi-argocd.teleport.parity.io" | ||
steps: | ||
- name: Deploy to ArgoCD | ||
uses: paritytech/argocd-deployment-action@main | ||
with: | ||
environment: "parity-versi" | ||
tag: "${{ env.VERSION }}" | ||
app_name: "${{ env.APP }}" | ||
app_packages: "${{ env.APP }}" | ||
argocd_server: ${{ env.ARGOCD_SERVER }} | ||
teleport_token: ${{ env.APP }} | ||
teleport_app_name: "versi-argocd" | ||
argocd_auth_token: ${{ secrets.ARGOCD_AUTH_TOKEN }} | ||
|
||
deploy-westend: | ||
name: Deploy Westend | ||
runs-on: ubuntu-latest | ||
environment: parity-testnet | ||
needs: [set-variables, docker-publish] | ||
env: | ||
VERSION: ${{ needs.set-variables.outputs.VERSION }} | ||
ARGOCD_SERVER: "westend-argocd.teleport.parity.io" | ||
steps: | ||
- name: Deploy to ArgoCD | ||
uses: paritytech/argocd-deployment-action@main | ||
with: | ||
environment: "parity-testnet" | ||
tag: "${{ env.VERSION }}" | ||
app_name: "testnet-manager-westend" | ||
app_packages: "testnet-manager-westend" | ||
argocd_server: ${{ env.ARGOCD_SERVER }} | ||
teleport_token: ${{ env.APP }} | ||
teleport_app_name: "argocd-testnet" | ||
argocd_auth_token: ${{ secrets.ARGOCD_AUTH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.