From caedca35983323d4378643fff27ad4b1dee040eb Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Mon, 13 Apr 2020 18:15:16 +0300 Subject: [PATCH] ci: Add release workflow - create GitHub release and link to changelog - build and push container image to Docker Hub - build kustomization and upload asset to GitHub release --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 50 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..0e03bbd1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: release +on: + push: + tags: + - 'v*' + +jobs: + build-push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Kustomize + uses: ./.github/actions/kustomize + - name: Generate release asset + run: | + mkdir -p config/release + cp config/default/* config/release + cd config/release + kustomize edit set image fluxcd/source-controller=fluxcd/source-controller:${{ github.ref }} + kustomize build . > source-controller.yaml + - name: Push image + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: fluxcd/source-controller + tag_with_ref: true + - name: Create release + id: create_release + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: true + body: | + [CHANGELOG](https://github.com/fluxcd/source-controller/blob/master/CHANGELOG.md) + - name: Upload artifacts + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./config/release/source-controller.yaml + asset_name: source-controller.yaml + asset_content_type: text/plain diff --git a/.gitignore b/.gitignore index 57c413ff..8f19ec80 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ # Dependency directories (remove the comment below to include it) # vendor/ bin/ +config/release/