diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml new file mode 100644 index 000000000..981a5ad40 --- /dev/null +++ b/.github/workflows/docker-release.yml @@ -0,0 +1,21 @@ +name: Docker Release + +on: + release: + types: [released] + +jobs: + trigger-build: + uses: ./.github/workflows/docker.yml + with: + tag: ${{ github.event.release.tag_name }} + secrets: inherit + upload-docker: + needs: trigger-build + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - name: Upload binary to existing release + run: make zip_linux_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index fc37c4292..062924bbe 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,28 +1,30 @@ -name: docker +name: Docker Build on: push: branches: - main - tags: - - '*' + workflow_call: + inputs: + tag: + description: 'Docker tag' + required: true + type: string + default: 'latest' jobs: build: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 - - name: Extract DOCKER_TAG using tag name - if: startsWith(github.ref, 'refs/tags/') - run: | - echo "DOCKER_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - - name: Use default DOCKER_TAG - if: startsWith(github.ref, 'refs/tags/') != true - run: | - echo "DOCKER_TAG=latest" >> $GITHUB_ENV + - name: Set Docker tag + if: github.event_name == 'workflow_call' + run: echo "DOCKER_TAG=${{ inputs.tag }}" >> $GITHUB_ENV + - name: Use default Docker tag + if: github.event_name == 'push' + run: echo "DOCKER_TAG=latest" >> $GITHUB_ENV - name: Set lowercase repository name - run: | - echo "REPOSITORY_LC=${REPOSITORY,,}" >>${GITHUB_ENV} + run: echo "REPOSITORY_LC=${REPOSITORY,,}" >> $GITHUB_ENV env: REPOSITORY: '${{ github.repository }}' - name: Set up Docker Buildx @@ -31,7 +33,7 @@ jobs: uses: docker/login-action@v3 with: username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io - uses: docker/build-push-action@v6 with: diff --git a/Releasing.md b/Releasing.md index fe7520ad4..93aa81683 100644 --- a/Releasing.md +++ b/Releasing.md @@ -10,5 +10,4 @@ For SwiftLint contributors, follow these steps to cut a release: 1. Make sure you have the latest stable Xcode version installed and `xcode-select`ed 1. Release new version: `make release "0.2.0: Tumble Dry"` -1. Wait for the Docker CI job to finish then run: `make zip_linux_release` 1. Celebrate. :tada: