42807890af
Bumps [docker/login-action](https://github.com/docker/login-action) from 3 to 4. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v3...v4) --- updated-dependencies: - dependency-name: docker/login-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
75 lines
2.7 KiB
YAML
75 lines
2.7 KiB
YAML
name: Build and upload Node Status API container to harbor.nymte.ch
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
release_image:
|
|
description: 'Tag image as a release'
|
|
required: true
|
|
default: false
|
|
type: boolean
|
|
|
|
env:
|
|
WORKING_DIRECTORY: "nym-node-status-api/nym-node-status-api"
|
|
CONTAINER_NAME: "node-status-api"
|
|
|
|
jobs:
|
|
build-container:
|
|
runs-on: arc-linux-latest-dind
|
|
steps:
|
|
- name: Login to Harbor
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: harbor.nymte.ch
|
|
username: ${{ secrets.HARBOR_ROBOT_USERNAME }}
|
|
password: ${{ secrets.HARBOR_ROBOT_SECRET }}
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Configure git identity
|
|
run: |
|
|
git config --global user.email "lawrence@nymtech.net"
|
|
git config --global user.name "Lawrence Stalder"
|
|
|
|
- name: Get version from cargo.toml
|
|
id: get_version
|
|
run: |
|
|
VERSION=$(yq -oy '.package.version' ${{ env.WORKING_DIRECTORY }}/Cargo.toml)
|
|
echo "result=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Set GIT_TAG variable
|
|
run: echo "GIT_TAG=${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }}" >> $GITHUB_ENV
|
|
|
|
- name: Initialise RELEASE_TAG
|
|
run: echo "RELEASE_TAG=" >> $GITHUB_ENV
|
|
|
|
- name: Set RELEASE_TAG for release
|
|
if: github.event.inputs.release_image == 'true'
|
|
run: echo "RELEASE_TAG=golden-" >> $GITHUB_ENV
|
|
|
|
- name: Set IMAGE_NAME_AND_TAGS variable
|
|
run: echo "IMAGE_NAME_AND_TAGS=${{ env.CONTAINER_NAME }}:${{ env.RELEASE_TAG }}${{ steps.get_version.outputs.result }}" >> $GITHUB_ENV
|
|
|
|
- name: New env vars
|
|
run: echo "RELEASE_TAG='$RELEASE_TAG' GIT_TAG='$GIT_TAG' IMAGE_NAME_AND_TAGS='$IMAGE_NAME_AND_TAGS'"
|
|
|
|
# - name: Remove existing tag if exists, then create
|
|
# run: |
|
|
# if git rev-parse "$GIT_TAG" >/dev/null 2>&1; then
|
|
# echo "Tag '$GIT_TAG' already exists, deleting"
|
|
# git push --delete origin "$GIT_TAG"
|
|
# git tag -d "$GIT_TAG"
|
|
# echo "Tag '$GIT_TAG' deleted"
|
|
# else
|
|
# echo "Tag '$GIT_TAG' does not exist, creating it"
|
|
# git tag -a $GIT_TAG -m "Version ${{ steps.get_version.outputs.result }}"
|
|
# git push origin $GIT_TAG
|
|
# echo "Tag '$GIT_TAG' created"
|
|
# fi
|
|
|
|
- name: BuildAndPushImageOnHarbor
|
|
run: |
|
|
docker build -f ${{ env.WORKING_DIRECTORY }}/Dockerfile . -t harbor.nymte.ch/nym/${{ env.IMAGE_NAME_AND_TAGS }} -t harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }}:latest
|
|
docker push harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }} --all-tags
|
|
|