diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f4db7e2 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ +name: Build and Publish Docker Image + +on: + push: + branches: + - main + tags: + - '*' + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Get tag version + id: prep + run: | + if [[ $GITHUB_REF == refs/heads/main ]]; then + echo "::set-output name=version::latest" + else + echo "::set-output name=version::${GITHUB_REF#refs/tags/}" + fi + - uses: docker/build-push-action@v2 + with: + context: . + file: Dockerfile + push: true + tags: ghcr.io/${{ github.repository_owner }}/url-to-png:${{ steps.prep.outputs.version }} diff --git a/README.md b/README.md index 8b30574..c1a0d68 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ A URL to PNG generator over HTTP with a fairly simple API accessed via query par Run the following command: ``` -docker run --rm -p 3000:3000 jasonraimondi/url-to-png +docker run --rm -p 3000:3000 ghcr.io/jasonraimondi/url-to-png ``` On the hub: [Link to DockerHub](https://hub.docker.com/r/jasonraimondi/url-to-png/)