Skip to content

Commit

Permalink
Include version in release artifacts
Browse files Browse the repository at this point in the history
Tag docker image with version and include version in .tgz file names

Signed-off-by: James Taylor <[email protected]>
  • Loading branch information
jt-nti committed May 19, 2022
1 parent 328b1f7 commit 89b3ae0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,22 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Build Docker image
run: docker build . --file Dockerfile --tag ghcr.io/hyperledgendary/k8s-fabric-peer:${GITHUB_SHA}
run: |
docker build . --file Dockerfile --label "git_commit=${GITHUB_SHA}" --tag k8s-fabric-peer
docker tag k8s-fabric-peer ghcr.io/hyperledgendary/k8s-fabric-peer:${GITHUB_SHA}
if [ "${GITHUB_REF:0:10}" = "refs/tags/" ]; then
docker tag k8s-fabric-peer ghcr.io/hyperledgendary/k8s-fabric-peer:${GITHUB_REF_NAME}
docker tag k8s-fabric-peer ghcr.io/hyperledgendary/k8s-fabric-peer:latest
fi
- name: Publish Docker image
if: github.event_name != 'pull_request'
run: |
echo ${DOCKER_PW} | docker login ghcr.io -u ${DOCKER_USER} --password-stdin
docker push ghcr.io/hyperledgendary/k8s-fabric-peer:${GITHUB_SHA}
if [ "${GITHUB_REF:0:10}" = "refs/tags/" ]; then
docker push ghcr.io/hyperledgendary/k8s-fabric-peer:${GITHUB_REF_NAME}
docker push ghcr.io/hyperledgendary/k8s-fabric-peer:latest
fi
env:
DOCKER_USER: ${{ github.actor }}
DOCKER_PW: ${{ secrets.GITHUB_TOKEN }}
6 changes: 5 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ jobs:
CGO_ENABLED=0 go build -v ./cmd/detect
CGO_ENABLED=0 go build -v ./cmd/release
CGO_ENABLED=0 go build -v ./cmd/run
tar -czvf fabric-builder-k8s-${RUNNER_OS}-${RUNNER_ARCH}.tgz build detect release run
tar -czvf fabric-builder-k8s.tgz build detect release run
- name: Rename package
if: startsWith(github.ref, 'refs/tags/')
run: mv fabric-builder-k8s.tgz fabric-builder-k8s-${GITHUB_REF_NAME}-${RUNNER_OS}-${RUNNER_ARCH}.tgz

- name: Release
uses: softprops/action-gh-release@v1
Expand Down

0 comments on commit 89b3ae0

Please sign in to comment.