-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from hyperledger/actions
Add GitHub action to build commits to main
- Loading branch information
Showing
2 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Docker Main Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set build tag | ||
id: build_tag_generator | ||
run: | | ||
RELEASE_TAG=$(curl https://api.github.com/repos/hyperledger/firefly-fabconnect/releases/latest -s | jq .tag_name -r) | ||
BUILD_TAG=$RELEASE_TAG-$(date +"%Y%m%d")-$GITHUB_RUN_NUMBER | ||
echo ::set-output name=BUILD_TAG::$BUILD_TAG | ||
- name: Build | ||
run: | | ||
docker build \ | ||
--label commit=$GITHUB_SHA \ | ||
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ | ||
--label tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }} \ | ||
--tag ghcr.io/hyperledger/firefly-fabconnect:${{ steps.build_tag_generator.outputs.BUILD_TAG }} . | ||
- name: Tag release | ||
run: docker tag ghcr.io/hyperledger/firefly-fabconnect:${{ steps.build_tag_generator.outputs.BUILD_TAG }} ghcr.io/hyperledger/firefly-fabconnect:head | ||
|
||
- name: Push docker image | ||
run: | | ||
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin | ||
docker push ghcr.io/hyperledger/firefly-fabconnect:${{ steps.build_tag_generator.outputs.BUILD_TAG }} | ||
- name: Push head tag | ||
run: | | ||
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin | ||
docker push ghcr.io/hyperledger/firefly-fabconnect:head |
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