-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: try to publish docker on push tags v* (#1430)
* fix: try to publish docker on push tags v*
- Loading branch information
1 parent
b2be045
commit f6bebfe
Showing
2 changed files
with
72 additions
and
65 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
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,72 @@ | ||
name: Publish Docker images | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
jobs: | ||
publish-docker-images: | ||
name: Publish aimmo Docker images | ||
if: github.event.head_commit.author.email == 'action@github.com' | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: "[Debug] Print github.ref" | ||
run: echo "${{ github.ref }}" | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Set docker tag | ||
id: docker_tag | ||
run: | | ||
echo "::set-output name=tag::${GITHUB_REF:11}" # this is either branch name or tag after first character ('v') | ||
- name: Build and push aimmo-game image | ||
id: game | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: aimmo-game | ||
file: aimmo-game/Dockerfile | ||
tags: ocadotechnology/aimmo-game:${{ steps.docker_tag.outputs.tag }} | ||
target: runner | ||
push: true | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
- name: Build and push aimmo-game-creator image | ||
id: game_creator | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: aimmo-game-creator | ||
file: aimmo-game-creator/Dockerfile | ||
tags: ocadotechnology/aimmo-game-creator:${{ steps.docker_tag.outputs.tag }} | ||
target: runner | ||
push: true | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
- name: Image digest | ||
run: | | ||
echo ${{ steps.game.outputs.digest }} | ||
echo ${{ steps.game_creator.outputs.digest }} | ||
notify-semaphore: | ||
name: Notify Semaphore | ||
needs: [publish-docker-images] | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Notify Semaphore (Staging) | ||
run: curl -d POST -v https://semaphoreci.com/api/v1/projects/${SEMAPHORE_PROJECT_ID}/master/build?auth_token=${SEMAPHORE_API_AUTH} | ||
env: | ||
SEMAPHORE_PROJECT_ID: ${{ secrets.SEMAPHORE_PROJECT_ID }} | ||
SEMAPHORE_API_AUTH: ${{ secrets.SEMAPHORE_API_AUTH }} |