diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index f0822f4..82d7a49 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -10,17 +10,37 @@ on: jobs: build: runs-on: ubuntu-latest + + permissions: + packages: write + contents: read + env: - tag: ${{ secrets.CI_REGISTRY }}/geekpie/shanghaitech-mirror-frontend:latest + REGISTRY: ghcr.io + USERNAME: ShanghaitechGeekPie + IMAGE_NAME : ${{ github.repository }} + steps: - - uses: actions/checkout@v3 - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - registry: ${{ secrets.CI_REGISTRY }} - username: ${{ secrets.CI_REGISTRY_USER }} - password: ${{ secrets.CI_REGISTRY_PASSWORD }} - - name: Build the Docker image - run: docker build . --file Dockerfile --tag $tag - - name: Push the Docker image - run: docker push $tag \ No newline at end of file + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Login to Container registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ env.USERNAME }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/index.html b/index.html index e85f991..7fe601b 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,6 @@
- +