update py-test #9
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: Deploy to Docker Registry | |
on: | |
push: | |
branches: | |
- egame | |
env: | |
DOCKER_REPOSITORY: "pluto-frontend" # set this to your repository name | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to docker registry | |
uses: docker/login-action@v2 | |
with: | |
registry: py-test.egame.kh.edu.tw # TODO: change url base on branch | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Generate docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | # TODO: change url base on branch | |
py-test.egame.kh.edu.tw/${{ env.DOCKER_REPOSITORY }} | |
tags: | | |
type=raw,value={{branch}}-{{sha}}-{{date 'X' tz='Asia/Taipei'}} | |
- name: Build, tag, and push image to registry | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |