Skip to content

Commit

Permalink
fix(ci): trigger on create
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli committed Feb 12, 2021
1 parent fdfe260 commit aacdcdf
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on: [pull_request, push]
on: [create, pull_request, push]

env:
IMAGE_ID: ${{ github.repository }}
Expand All @@ -18,7 +18,7 @@ jobs:
uses: docker/setup-buildx-action@v1.1.1

- name: Registry login
if: github.event_name == 'push'
if: github.event_name != 'pull_request'
run: echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USER_NAME }}" --password-stdin

- name: Build
Expand All @@ -33,7 +33,25 @@ jobs:
echo VERSION=$VERSION
# Push the Docker image to the registry on git pushes that either pushed a tag or one of the following branches: [master, develop]
if [[ "${{ github.event_name }}" == "push" && (${{startsWith(github.ref, 'refs/tags/')}} == "true" || (${{startsWith(github.ref, 'refs/heads/')}} == "true" && ($VERSION == "latest" || $VERSION == "develop"))) ]]
if [[
(
"${{ github.event_name }}" == "create"
&&
${{ startsWith(github.ref, 'refs/tags/') }} == "true"
)
||
(
"${{ github.event_name }}" == "push"
&&
${{ startsWith(github.ref, 'refs/heads/') }} == "true"
&&
(
$VERSION == "latest"
||
$VERSION == "develop"
)
)
]]
then
docker buildx build \
--cache-from=$IMAGE_ID:cache \
Expand Down

0 comments on commit aacdcdf

Please sign in to comment.