diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..cd8c8b0 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,32 @@ +name: Push to GitHub Container Registry + +on: + release: + types: [released] + +env: + IMAGE_NAME: reveal.js-docker + +jobs: + push: + runs-on: ubuntu-latest + steps: + - name: Check-out github repository + uses: actions/checkout@v2 + + - name: Log into GitHub Container Registry + run: echo "${{ secrets.SECRET_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Build Docker image + run: docker build . --tag $IMAGE_NAME + + - name: Push Docker image + run: | + IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME + + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION \ No newline at end of file