Conflict/feature/met 1630 display absolute slot number #3874
Workflow file for this run
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
name: Publish Artifacts | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
types: [ opened, synchronize ] | |
workflow_dispatch: | |
env: | |
PRIVATE_DOCKER_REGISTRY_URL: ${{ secrets.GITLAB_DOCKER_REGISTRY_URL }} | |
PRIVATE_DOCKER_REGISTRY_USER: Deploy-Token | |
PRIVATE_DOCKER_REGISTRY_PASS: ${{ secrets.GITLAB_PKG_REGISTRY_TOKEN }} | |
jobs: | |
publish: | |
permissions: | |
contents: read | |
packages: write | |
runs-on: self-hosted | |
if: | | |
"contains(github.event.head_commit.message, 'release-please--branches--main')" || | |
${{ github.event_name == 'pull_request' }} | |
steps: | |
- name: ⬇️ Checkout | |
uses: actions/checkout@v3 | |
- name: 🫡 Setup node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: Set extra environment and metadata | |
id: metadata | |
run: | | |
DOCKER_IMAGE_NAME=$(basename ${GITHUB_REPOSITORY}) | |
echo "DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME}" >> "$GITHUB_ENV" | |
if [ ${{github.event_name}} == "pull_request" ] | |
then | |
PR_NUMBER=$(echo $GITHUB_REF | awk -F/ '{ print $3 }') | |
echo "ARTIFACT_VERSION=$(sed -n 's/.*\"version\": *\"\([^\"]*\)\".*/\1/p' package.json)-PR${PR_NUMBER}" >> $GITHUB_ENV | |
echo "DOCKER_LATEST_IMAGE_TAG=" >> $GITHUB_ENV | |
else | |
CURRENT_VERSION="$(sed -n 's/.*\"version\": *\"\([^\"]*\)\".*/\1/p' package.json)" | |
echo "ARTIFACT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV | |
BRANCH=${GITHUB_REF##*/} | |
if [[ "${BRANCH}" == "develop" ]] | |
then | |
echo "ARTIFACT_VERSION=${CURRENT_VERSION}-develop" >> $GITHUB_ENV | |
echo "DOCKER_LATEST_IMAGE_TAG=" >> $GITHUB_ENV | |
else | |
echo "DOCKER_LATEST_IMAGE_TAG=${{ env.PRIVATE_DOCKER_REGISTRY_URL }}/${DOCKER_IMAGE_NAME}:latest" >> "$GITHUB_ENV" | |
fi | |
fi | |
- name: 🐳 Docker Login | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.PRIVATE_DOCKER_REGISTRY_URL }} | |
username: ${{ env.PRIVATE_DOCKER_REGISTRY_USER }} | |
password: ${{ env.PRIVATE_DOCKER_REGISTRY_PASS }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: 🔨 Build and Push docker image | |
uses: docker/build-push-action@v4 | |
with: | |
file: ./Dockerfile | |
context: . | |
push: true | |
tags: | | |
${{ env.DOCKER_LATEST_IMAGE_TAG }} | |
${{ env.PRIVATE_DOCKER_REGISTRY_URL }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.ARTIFACT_VERSION }} |