diff --git a/.github/workflows/build-on-branch.yml b/.github/workflows/build-on-branch.yml new file mode 100644 index 0000000..238b00a --- /dev/null +++ b/.github/workflows/build-on-branch.yml @@ -0,0 +1,21 @@ +name: Build tag + +on: + push: + branches: + - 'main' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build + run: docker build . -t tandrade/short:$(echo $([[ $(git rev-parse --abbrev-ref HEAD) == master ]] && echo latest || echo latest-modsec)) + - name: Login + uses: docker/login-action@v1.10.0 + with: + username: tandrade + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: Push + run: docker push tandrade/short:$(echo $([[ $(git rev-parse --abbrev-ref HEAD) == master ]] && echo latest || echo latest-modsec)) diff --git a/.github/workflows/build-on-tag.yml b/.github/workflows/build-on-tag.yml new file mode 100644 index 0000000..f07f961 --- /dev/null +++ b/.github/workflows/build-on-tag.yml @@ -0,0 +1,21 @@ +name: Build tag + +on: + create: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build + run: docker build . -t tandrade/short:${GITHUB_REF/refs\/tags\//} + - name: Login + uses: docker/login-action@v1.10.0 + with: + username: tandrade + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: Push + run: docker push tandrade/short:${GITHUB_REF/refs\/tags\//}