Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small workflow updates #5

Merged
merged 5 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 29 additions & 18 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,20 @@ concurrency:
cancel-in-progress: true

jobs:
build-and-publish:
name: Build and Push
build:
name: Build
runs-on: self-hosted-hoprnet-small

strategy:
matrix:
node-version: [20.x, 21.x, 22.x]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: hoprnet/hopr-workflows/actions/setup-node-js@master
with:
node-version: 20

- name: Setup GCP
uses: hoprnet/hopr-workflows/actions/setup-gcp@master
with:
google-credentials: ${{ secrets.GOOGLE_HOPRASSOCIATION_CREDENTIALS_REGISTRY }}
login-artifact-registry: 'true'

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: kubernetes
node-version: ${{ matrix.node-version }}

- name: Building
run: yarn build
Expand All @@ -45,14 +36,34 @@ jobs:
- name: Testing
run: yarn test

publish:
name: Publish
runs-on: self-hosted-hoprnet-small
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup GCP
id: gcp
uses: hoprnet/hopr-workflows/actions/setup-gcp@master
with:
google-credentials: ${{ secrets.GOOGLE_HOPRASSOCIATION_CREDENTIALS_REGISTRY }}
login-artifact-registry: 'true'

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: kubernetes

- name: Get PR version
id: variables
run: |
PR_VERSION=$(node -p "require('./package.json').version")-pr.${{ github.event.pull_request.number }}
PR_VERSION=$(jq -r '.version' ./package.json)-pr."${{ github.event.pull_request.number }}"
echo "PR_VERSION=${PR_VERSION}" >> $GITHUB_OUTPUT

- name: Build and push docker image
uses: docker/build-push-action@v4
with:
push: true
tags: europe-west3-docker.pkg.dev/hoprassociation/docker-images/uhttp-latency-monitor:${{ steps.variables.outputs.PR_VERSION }}
push: true
tags: ${{ vars.DOCKER_IMAGE_REGISTRY }}/${{ vars.DOCKER_IMAGE_NAME }}:${{ steps.variables.outputs.PR_VERSION }}
8 changes: 4 additions & 4 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup Node.js
uses: hoprnet/hopr-workflows/actions/setup-node-js@master
with:
node-version: 20
node-version: ${{ vars.NODE_VERSION }}

- name: Setup GCP
id: gcp
Expand All @@ -36,10 +36,10 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: kubernetes
driver: kubernetes

- name: Build and push docker image
uses: docker/build-push-action@v4
with:
push: true
tags: europe-west3-docker.pkg.dev/hoprassociation/docker-images/uhttp-latency-monitor:latest
push: true
tags: ${{ vars.DOCKER_IMAGE_REGISTRY }}/${{ vars.DOCKER_IMAGE_NAME }}:latest
15 changes: 7 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Node.js
uses: hoprnet/hopr-workflows/actions/setup-node-js@master
with:
node-version: 20
node-version: ${{ vars.NODE_VERSION }}

- name: Setup GCP
id: gcp
Expand All @@ -41,7 +41,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: kubernetes
driver: kubernetes

- name: Building
run: yarn build
Expand All @@ -64,15 +64,14 @@ jobs:
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: 'uhttp-latency-monitor - v${{ steps.environment.outputs.release_version }}'
name: '${{ vars.DOCKER_IMAGE_NAME }} - v${{ steps.environment.outputs.release_version }}'
tag_name: v${{ steps.environment.outputs.release_version }}


- name: Build and push docker image
uses: docker/build-push-action@v4
with:
push: true
tags: europe-west3-docker.pkg.dev/hoprassociation/docker-images/uhttp-latency-monitor:${{ steps.environment.outputs.release_version }}
push: true
tags: ${{ vars.DOCKER_IMAGE_REGISTRY }}/${{ vars.DOCKER_IMAGE_NAME }}:${{ steps.environment.outputs.release_version }}

- name: Bump Version
id: bump
Expand All @@ -93,7 +92,7 @@ jobs:
delete-branch: true
assignees: ${{ github.actor }}
reviewers: 'esterlus'
team-reviewers: '@hoprnet/hopr-devops'
team-reviewers: '@hoprnet/hopr-products-team'

- name: Notify new release
uses: zulip/github-actions-zulip/send-message@v1
Expand All @@ -105,4 +104,4 @@ jobs:
to: 'Releases'
topic: 'main'
content: |
I'm thrilled to inform the new **uhttp-latency-monitor** version **${{ steps.environment.outputs.release_version }}** has been released.
I'm thrilled to inform the new **${{ vars.DOCKER_IMAGE_NAME }}** version **${{ steps.environment.outputs.release_version }}** has been released.
Loading