diff --git a/.github/workflows/build.yml b/.github/workflows/publish-to-gh-pages.yml similarity index 78% rename from .github/workflows/build.yml rename to .github/workflows/publish-to-gh-pages.yml index b8af634..5cbeb50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/publish-to-gh-pages.yml @@ -1,4 +1,4 @@ -name: Build and Deploy to GH page +name: Build and Deploy to GH pages on: push: @@ -9,6 +9,11 @@ jobs: BuildAndDeploy: runs-on: ubuntu-latest + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + steps: - name: Checkout repository uses: actions/checkout@v3 diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index 4d6b08b..392e564 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -6,11 +6,11 @@ on: branches: - master +env: + REGISTRY: ghcr.io + IMAGE_NAME: vechain/insight-app jobs: - build: - env: - REGISTRY: ghcr.io - IMAGE_NAME: vechain/insight-app + publish: runs-on: ubuntu-latest permissions: contents: read @@ -22,23 +22,17 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Download artifact explorer - uses: actions/download-artifact@v2 - with: - name: insight-app - path: /tmp - - name: Load Docker images - run: | - docker load --input /tmp/insight-app.tar - docker image ls -a - - name: Tags images to publish - run: | - timestamp=`date +%s` - docker tag insight-app ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${timestamp} - docker tag insight-app ${{env.REGISTRY}}/${{env.IMAGE_NAME}} - docker tag insight-app ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{github.sha}} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Publish images - run: | - docker push -a ${{env.REGISTRY}}/${{env.IMAGE_NAME}} + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}