mirror of
https://github.com/lukaszraczylo/semver-generator.git
synced 2026-06-19 01:41:28 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
5aaaf3c599
|
|||
|
de8d0dba1d
|
|||
|
b51ea576a3
|
@@ -117,58 +117,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
args: ./...
|
args: ./...
|
||||||
|
|
||||||
build-docker:
|
|
||||||
needs: [ prepare, test, code_scans ]
|
|
||||||
name: Docker image build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
- name: Login to GHCR
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.ACTOR }}
|
|
||||||
password: ${{ secrets.GHCR_TOKEN }}
|
|
||||||
- name: Prepare for push
|
|
||||||
id: prep
|
|
||||||
run: |
|
|
||||||
if [ -z "${{ needs.prepare.outputs.RELEASE_VERSION }}" ]; then
|
|
||||||
TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest"
|
|
||||||
else
|
|
||||||
TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.RELEASE_VERSION }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest"
|
|
||||||
fi
|
|
||||||
echo "TAGS=$TAGS" >> $GITHUB_OUTPUT
|
|
||||||
BRANCH=$(echo ${GITHUB_REF##*/} | tr '[A-Z]' '[a-z]')
|
|
||||||
LABELS="org.opencontainers.image.revision=${{ needs.prepare.outputs.GITHUB_SHA }}"
|
|
||||||
LABELS="$LABELS,org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
|
||||||
LABELS="$LABELS,org.opencontainers.image.version=$VERSION"
|
|
||||||
LABELS="$LABELS,com.github.repo.branch=$BRANCH"
|
|
||||||
LABELS="$LABELS,com.github.repo.dockerfile=Dockerfile"
|
|
||||||
echo "LABELS=$LABELS" >> $GITHUB_OUTPUT
|
|
||||||
BUILD_ARGS="BRANCH=$BRANCH"
|
|
||||||
echo "args=$BUILD_ARGS" >> $GITHUB_OUTPUT
|
|
||||||
- name: Build image
|
|
||||||
id: docker_build
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
builder: ${{ steps.buildx.outputs.name }}
|
|
||||||
platforms: linux/arm64,linux/amd64
|
|
||||||
push: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
|
|
||||||
tags: ${{ steps.prep.outputs.tags }}
|
|
||||||
build-args: |
|
|
||||||
GITHUB_AUTH_TOKEN=${{ secrets.GHCR_TOKEN }}
|
|
||||||
MICROSERVICE_NAME=${{ github.event.repository.name }}
|
|
||||||
GITHUB_COMMIT_NUMBER=${{ needs.prepare.outputs.GITHUB_COMMIT_NUMBER }}
|
|
||||||
GITHUB_SHA=${{ needs.prepare.outputs.GITHUB_SHA }}
|
|
||||||
${{ steps.prep.outputs.args }}
|
|
||||||
labels: ${{ steps.prep.outputs.labels }}
|
|
||||||
no-cache: false
|
|
||||||
|
|
||||||
build-binary:
|
build-binary:
|
||||||
needs: [ prepare, test, code_scans ]
|
needs: [ prepare, test, code_scans ]
|
||||||
@@ -218,3 +166,56 @@ jobs:
|
|||||||
artifacts: "dist/*"
|
artifacts: "dist/*"
|
||||||
allowUpdates: true
|
allowUpdates: true
|
||||||
makeLatest: false
|
makeLatest: false
|
||||||
|
|
||||||
|
build-docker:
|
||||||
|
needs: [ prepare, test, code_scans, build-binary ]
|
||||||
|
name: Docker image build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
- name: Login to GHCR
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.ACTOR }}
|
||||||
|
password: ${{ secrets.GHCR_TOKEN }}
|
||||||
|
- name: Prepare for push
|
||||||
|
id: prep
|
||||||
|
run: |
|
||||||
|
if [ -z "${{ needs.prepare.outputs.RELEASE_VERSION }}" ]; then
|
||||||
|
TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest,${{ needs.prepare.outputs.DOCKER_IMAGE }}:v1"
|
||||||
|
else
|
||||||
|
TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.RELEASE_VERSION }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest,${{ needs.prepare.outputs.DOCKER_IMAGE }}:v1"
|
||||||
|
fi
|
||||||
|
echo "TAGS=$TAGS" >> $GITHUB_OUTPUT
|
||||||
|
BRANCH=$(echo ${GITHUB_REF##*/} | tr '[A-Z]' '[a-z]')
|
||||||
|
LABELS="org.opencontainers.image.revision=${{ needs.prepare.outputs.GITHUB_SHA }}"
|
||||||
|
LABELS="$LABELS,org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
||||||
|
LABELS="$LABELS,org.opencontainers.image.version=$VERSION"
|
||||||
|
LABELS="$LABELS,com.github.repo.branch=$BRANCH"
|
||||||
|
LABELS="$LABELS,com.github.repo.dockerfile=Dockerfile"
|
||||||
|
echo "LABELS=$LABELS" >> $GITHUB_OUTPUT
|
||||||
|
BUILD_ARGS="BRANCH=$BRANCH"
|
||||||
|
echo "args=$BUILD_ARGS" >> $GITHUB_OUTPUT
|
||||||
|
- name: Build image
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
|
platforms: linux/arm64,linux/amd64
|
||||||
|
push: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
|
||||||
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
|
build-args: |
|
||||||
|
GITHUB_AUTH_TOKEN=${{ secrets.GHCR_TOKEN }}
|
||||||
|
MICROSERVICE_NAME=${{ github.event.repository.name }}
|
||||||
|
GITHUB_COMMIT_NUMBER=${{ needs.prepare.outputs.GITHUB_COMMIT_NUMBER }}
|
||||||
|
GITHUB_SHA=${{ needs.prepare.outputs.GITHUB_SHA }}
|
||||||
|
${{ steps.prep.outputs.args }}
|
||||||
|
labels: ${{ steps.prep.outputs.labels }}
|
||||||
|
no-cache: false
|
||||||
|
|||||||
+3
-2
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh -l
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
FLAGS=""
|
FLAGS=""
|
||||||
|
|
||||||
@@ -36,5 +37,5 @@ fi
|
|||||||
cd /github/workspace
|
cd /github/workspace
|
||||||
OUT_SEMVER_GEN=$(/go/src/app/semver-gen generate $FLAGS $*)
|
OUT_SEMVER_GEN=$(/go/src/app/semver-gen generate $FLAGS $*)
|
||||||
[ $? -eq 0 ] || exit 1
|
[ $? -eq 0 ] || exit 1
|
||||||
echo "::set-output name=semantic_version::$(echo $OUT_SEMVER_GEN | sed -e 's|SEMVER ||g')"
|
echo "semantic_version=$(echo $OUT_SEMVER_GEN | sed -e 's|SEMVER ||g') >> $GITHUB_OUTPUT"
|
||||||
echo $OUT_SEMVER_GEN
|
echo $OUT_SEMVER_GEN
|
||||||
Reference in New Issue
Block a user