v2.0.0-alpha.4 #207
Workflow file for this run
This file contains hidden or 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: "build-docker" | |
| on: | |
| push: | |
| branches: | |
| - "*" | |
| tags: | |
| - "v*" | |
| jobs: | |
| build: | |
| name: "Build docker images" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@v2 | |
| - name: "Set env vars" | |
| id: vars | |
| run: | | |
| echo "GITHUB_SHA_SHORT=$(echo ${GITHUB_SHA} | cut -c1-8)" >> "${GITHUB_ENV}" | |
| echo "IMAGE_NAME=$(echo "ghcr.io/${{ secrets.CR_USER }}/droppy")" >> "${GITHUB_ENV}" | |
| echo "REFNAME=$(echo "${{ github.ref }}" | sed -e 's/.*\///')" >> "${GITHUB_ENV}" | |
| echo "TAGNAME=$(echo "${{ github.ref }}" | sed -e 's/.*\/v//')" >> "${GITHUB_ENV}" | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Dockerfile-dev | |
| run: | | |
| cat Dockerfile | sed -e 's/^RUN git clone.*/COPY [ ".", "\/droppy" ]/' > Dockerfile-dev | |
| - name: Set the tag name in package.json if tag | |
| if: "contains(github.ref, 'refs/tags')" | |
| run: | | |
| sed -i -E 's/^ *\t*"version": *"([^"]*)",.*/ "version": "\1", "tag": "'"${{ env.TAGNAME }}"'",/' packages/server/package.json | |
| - name: Set the git revision in package.json if not tag | |
| if: "!contains(github.ref, 'refs/tags')" | |
| run: | | |
| sed -i -E 's/^ *\t*"version": *"([^"]*)",.*/ "version": "\1", "tag": "'"${{ env.GITHUB_SHA_SHORT }}"'",/' packages/server/package.json | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Build and push multi-arch image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: Dockerfile-dev | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| ${{ env.IMAGE_NAME }}:${{ env.GITHUB_SHA_SHORT }} | |
| ${{ env.IMAGE_NAME }}:${{ env.REFNAME }} | |
| ${{ startsWith(github.ref, 'refs/tags/') && format('{0}:latest', env.IMAGE_NAME) || '' }} | |
| - name: Build Changelog | |
| id: github_release | |
| uses: mikepenz/release-changelog-builder-action@v2.4.0 | |
| with: | |
| configuration: "changelog.json" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: "Create release" | |
| if: "contains(github.ref, 'refs/tags')" | |
| id: "create_release" | |
| uses: "actions/create-release@v1" | |
| env: | |
| GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| with: | |
| tag_name: "${{ github.ref }}" | |
| release_name: "Release ${{ github.ref }}" | |
| draft: false | |
| prerelease: false | |
| body: ${{steps.github_release.outputs.changelog}} |