diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..67c8d56 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,18 @@ +name-template: 'v$NEXT_PATCH_VERSION 🌈' +tag-template: 'v$NEXT_PATCH_VERSION' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '🧰 Maintenance' + label: 'chore' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +template: | + ## Changes + $CHANGES diff --git a/.github/workflows/release-drafter-ci.yml b/.github/workflows/release-drafter-ci.yml new file mode 100644 index 0000000..b7c8be3 --- /dev/null +++ b/.github/workflows/release-drafter-ci.yml @@ -0,0 +1,13 @@ +name: Release Drafter +on: + push: + branches: + - master +jobs: + build: + name: Release Drafter + runs-on: ubuntu-latest + steps: + - uses: toolmantim/release-drafter@v5.2.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/vi-v-build-action.yml b/.github/workflows/vi-v-build-action.yml index 0763fd3..8fa8268 100644 --- a/.github/workflows/vi-v-build-action.yml +++ b/.github/workflows/vi-v-build-action.yml @@ -1,27 +1,92 @@ name: Build Vi-v on: -- push -- pull_request + push: + pull_request: + schedule: +# ┌───────────── minute (0 - 59) +# │ ┌───────────── hour (0 - 23) +# │ │ ┌───────────── day of the month (1 - 31) +# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) +# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + - cron: '0 0 * * 0' jobs: + build: - name: Build with ${{ matrix.os }} - runs-on: - - ${{ matrix.os }} + name: Build + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - arch: [X64] + platform: + - amd64 + - arm64 + - arm/v7 + - ppc64le + - s390x + - 386 steps: - - name: Checkout + - name: Checkout code from Git repository uses: actions/checkout@v2 - - name: Set up V version master - uses: nocturlab/setup-vlang-action@v1 + + - id: buildx + name: Set up Docker Buildx + uses: crazy-max/ghaction-docker-buildx@v1 with: - v-version: master - id: v - - name: Build Vi-v + buildx-version: latest + qemu-version: latest + + - name: Log into registry + run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin + + - name: Build & Push + run: | + IMAGE_ID=shiishii/labo + # Change all uppercase to lowercase + IMAGE_ID=$(echo ${IMAGE_ID} | tr '[A-Z]' '[a-z]') + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo ${VERSION} | sed -e 's/^v//') + # Use Docker `latest` tag convention + [ "$VERSION" == "master" ] && VERSION=latest + if [ -n "${{ matrix.platform }}" ]; then + _platform=${{ matrix.platform }} + VERSION="${VERSION}-${_platform//\/}" + fi + echo "IMAGE_ID=${IMAGE_ID}" + echo "VERSION=${VERSION}" + + docker buildx build \ + --platform linux/${{ matrix.platform }} \ + --tag ${IMAGE_ID}:${VERSION} \ + --file ./Dockerfile \ + --output type=image,push=true . + + publish: + name: Publish + runs-on: ubuntu-latest + needs: build + env: + DOCKER_CLI_EXPERIMENTAL: enabled + steps: + - name: Get current branch run: | - make + BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g') + if [ "${BRANCH_NAME}" = "master" ]; then + BRANCH_NAME="latest" + fi + echo "::set-env name=BRANCH_NAME::${BRANCH_NAME}" + - run: | + echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin + + docker manifest create shiishii/labo:${{ env.BRANCH_NAME }} \ + shiishii/labo:${{ env.BRANCH_NAME }}-amd64 \ + shiishii/labo:${{ env.BRANCH_NAME }}-arm64 \ + shiishii/labo:${{ env.BRANCH_NAME }}-armv7 \ + shiishii/labo:${{ env.BRANCH_NAME }}-ppc64le \ + shiishii/labo:${{ env.BRANCH_NAME }}-s390x \ + shiishii/labo:${{ env.BRANCH_NAME }}-386 + + docker manifest push shiishii/labo:${{ env.BRANCH_NAME }}