Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Build docker image and push to GPR with GitHub Actions
name: Build and publish Jekyll Docker image for Octocat Generator
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: clean up, docker login && docker build && docker push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPR_PAT: ${{ secrets.GPR_PAT }}
run: |
./cleanup.sh
docker login -u ${GITHUB_ACTOR} -p ${GPR_PAT} docker.pkg.github.com
docker build -t docker.pkg.github.com/${GITHUB_REPOSITORY}/octocat-generator:v-${GITHUB_SHA} .
curl -s -H "Authorization: Token ${GITHUB_TOKEN}" -H "Accept: application/json" -H "Content-type: application/json" -X POST -d "{ \"ref\": \"refs/tags/v-${GITHUB_SHA}\", \"sha\": \"${GITHUB_SHA}\"}" https://api.github.com/repos/${GITHUB_REPOSITORY}/git/refs
docker push docker.pkg.github.com/${GITHUB_REPOSITORY}/octocat-generator:v-${GITHUB_SHA}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.