fix: run on gh runners #12
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
name: mover | |
on: | |
push: | |
branches-ignore: | |
- 'main' | |
pull_request: | |
types: [closed] | |
branches: | |
- 'main' | |
jobs: | |
build: | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checking out repository | |
uses: actions/checkout@v3 | |
- name: Login to GCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ vars.REGISTRY }} | |
username: _json_key | |
password: ${{ secrets.GCR_JSON_KEY }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ulule | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Removing slashes from branch name when not tag or dev branch | |
id: git_tag | |
run: | | |
if [[ "${{ github.event.pull_request.merged }}" == "true" ]] && [[ "${{ github.ref_name }}" == 'main' ]] && [[ "${{ github.event.pull_request.title }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "GIT_TAG=${{ github.event.pull_request.title }}" >> "$GITHUB_OUTPUT" | |
else | |
echo "GIT_TAG=${GIT_REF//\//-}" >> "$GITHUB_OUTPUT" | |
fi | |
env: | |
GIT_REF: ${{ github.ref_name }} | |
- name: Build app and push | |
uses: docker/build-push-action@v4 | |
with: | |
file: Dockerfile | |
push: true | |
tags: ${{ vars.REGISTRY }}/mover:${{ github.sha }},${{ vars.REGISTRY }}/mover:${{ steps.git_tag.outputs.GIT_TAG }} | |
cache-from: type=registry,ref=${{ vars.REGISTRY }}/mover:cache | |
cache-to: type=registry,ref=${{ vars.REGISTRY }}/mover:cache,mode=min,compression=zstd |