Merge pull request #54 from wiemanboy/feature/modern-sass-compiler #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Docker image | |
on: | |
push: | |
branches: | |
- master | |
- release/* | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.APP_CLIENT_ID }} | |
private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Auth GitHub CLI | |
run: echo "GITHUB_TOKEN=${{steps.app-token.outputs.token}}" >> $GITHUB_ENV | |
- name: Get version from package.json | |
id: get_version | |
run: | | |
VERSION=$(jq -r '.version' package.json) | |
echo "Version: $VERSION" | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Authorize in Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: | | |
${{ secrets.DOCKER_HUB_USERNAME }}/${{ vars.DOCKER_IMAGE_NAME }}:${{ env.VERSION }} | |
${{ github.ref == 'refs/heads/master' && format('{0}/{1}:latest', secrets.DOCKER_HUB_USERNAME, vars.DOCKER_IMAGE_NAME) || '' }} | |
- name: Create release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: ${{ github.event.repository.name }} v${{ env.VERSION }} | |
tag_name: ${{ env.VERSION }} | |
body: | | |
[> DockerHub](https://hub.docker.com/r/${{ secrets.DOCKER_HUB_USERNAME }}/${{ vars.DOCKER_IMAGE_NAME }}/tags?name=${{ env.VERSION }}) | |
```bash | |
docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/${{ vars.DOCKER_IMAGE_NAME }}:${{ env.VERSION }} | |
``` |