diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..b5724416 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,55 @@ +name: Publish + +on: + push: + +jobs: + publish: + runs-on: ubuntu-latest + env: + GO_VERSION: 1.15 + GOX_ARCHITECTURES: amd64 386 + steps: + # Currently there is no possibility to get a tag name. Hence we filter the GITHUB_REF variable which contains something like "refs/tags/v2.0.0" if the tag is "v2.0.0". The value can be used with "steps.tag_name.outputs.TAG_NAME" + - name: Get tag name + if: startsWith(github.ref, 'refs/tags/') + id: tag_name + run: | + echo "::set-output name=TAG_NAME::${GITHUB_REF#refs/tags/}" + echo "$TAG_NAME" + + - name: Checkout the code + uses: actions/checkout@v2 + + - name: Setup Go environment + uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + - run: go version + + - name: Execute the tests + run: go test -race -p=1 ./... + + - name: Build the binaries + if: startsWith(github.ref, 'refs/tags/') + run: | + go get github.com/mitchellh/gox + go mod vendor + gox -os="linux" -arch="${{ env.GOX_ARCHITECTURES }}" -output="dist/link-${{ steps.tag_name.outputs.TAG_NAME }}-{{.OS}}-{{.Arch}}/{{.Dir}}" -ldflags="-X main.Version=${{ steps.tag_name.outputs.TAG_NAME }}" . ./cmd/... + + - name: Archive the built binaries + if: startsWith(github.ref, 'refs/tags/') + run: | + for gox_archi in $GOX_ARCHITECTURES; do + echo "Archive release targetted to $gox_archi" + # Gox compiles link-client and an executable named "v2" instead of "link".. + mv dist/link-${{ steps.tag_name.outputs.TAG_NAME }}-linux-${gox_archi}/v2 dist/link-${{ steps.tag_name.outputs.TAG_NAME }}-linux-${gox_archi}/link + tar --directory=dist -czvf "dist/link-${{ steps.tag_name.outputs.TAG_NAME }}-linux-${gox_archi}.tar.gz" "link-${{ steps.tag_name.outputs.TAG_NAME }}-linux-${gox_archi}" + done + + - name: Release the new version + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + body: Please refer to the [CHANGELOG.md](https://github.com/Scalingo/link/blob/${{ steps.tag_name.outputs.TAG_NAME }}/CHANGELOG.md) file. + files: dist/*.tar.gz diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1acdce03..00000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: go - -go: - - "1.15.x" - -before_install: - - go get github.com/mitchellh/gox - - go mod vendor - -script: - - go test -race -p=1 ./... - - gox -os="linux" -arch="amd64 386" -output="dist/link-$TRAVIS_TAG-{{.OS}}-{{.Arch}}/{{.Dir}}" -ldflags="-X main.Version=$TRAVIS_TAG" . ./cmd/... - - tar -C dist -czvf "dist/link-$TRAVIS_TAG-linux-386.tar.gz" "link-$TRAVIS_TAG-linux-386" - - tar -C dist -czvf "dist/link-$TRAVIS_TAG-linux-amd64.tar.gz" "link-$TRAVIS_TAG-linux-amd64" - -deploy: - provider: releases - skip_cleanup: true - on: - tags: true - repo: Scalingo/link - file_glob: true - file: - - "dist/*.tar.gz" - api_key: - secure: 1BJp7S5Ef4Sfzafw8StLvm7/HtLjY7USyAMW8jgiUmBzLnE/pgFBmGs4hx7NgmUumWfND/FJTgpz46HA6M3V1sza3mxA6SClfW9FM4U4lvie7DkydxMVdtEG398uqZZ9tyrVdkd7AJHX9ECRtZXC12ZlBWQVbgZ4tbX0iVuBnhZJYkGobwLqlpqoU/N2jUrBk6oCo6upE54MhnRFP3+yQnizvTvoiMcpQLyV1zLCiZiTP3P4oyMwH5TZzjXOMS92eqiITNKbeeNCGrVwK486FjACFphDMG+HVumHSGLggkwZaWdb6WsvPV0Gyxy9qZlmrJZm/PYrf03nKr1LXXHLkyaAdEaQnysiYV10DawtzsjkAwlSu+5ODzv3F0fZSSDURR3I7HNumvmVQY0EYW6UEKp69NV+cTFN2QTPzpoKGigZyvrKg5iCozuR6trluGxExUJNk/aWvGD3xGQ/IvbRLSbLtgmaXCiZJ8/YOysFIXN7lVm4AK8RNkS4zygdN4PYZ0UGfo5NNGSGUrkvWbhd2I3M47nV5ddlG05J4AuBF3rIpw+H6xffMUNvWN5b9ho/5C8BY8nt+BrJbTnEtsWM/GrKt75Do4PDTj65Y+ZnwdNefH6leFM87ozgYs2YJKPIgqKYQJ6Ligpkv92sN1q8Ii0SG+stzdQrkC/8SEGW0DM= diff --git a/CHANGELOG.md b/CHANGELOG.md index d5912a04..2b64b6ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,9 @@ * chore(deps): update github.com/looplab/fsm v0.0.0-20180515091235-f980bdb68a89 => v0.3.0 * chore(deps): bump go.etcd.io to Go Module version * chore(deps): update github.com/Scalingo/go-utils/etcd v1.0.1 => v1.1.0 +* chore: replace Travis CI with GitHub Actions to release new versions -## [2021-07-30] 2.0.0 +## [2021-07-30] v2.0.0 * chore(Dependabot): Update various dependencies * Bump github.com/sirupsen/logrus from 1.8.0 to 1.8.1 @@ -24,40 +25,40 @@ * Bad request body key is `error` instead of `msg` * Not found body is `{"resource": "IP", "error" : "not found"}` -## [2020-11-20] 1.9.3 +## [2020-11-20] v1.9.3 * Update deps: use github.com/Scalingo/go-philae/v4@v4.4.2 -## [2020-11-19] 1.9.2 +## [2020-11-19] v1.9.2 * Update deps: use go.etcd.io/etcd/v3 instead of github.com/coreos/etcd -## [2020-11-19] 1.9.1 +## [2020-11-19] v1.9.1 * Update deps: github.com/Scalingo/go-utils, use submodules instead of global -## [2020-05-06] 1.9.0 +## [2020-05-06] v1.9.0 * Use a single ETCD lease per server instead of one per IP to reduce load on the etcd cluster * Validate the health check port value to be in the range [1:65535] -## [2020-03-06] 1.8.4 +## [2020-03-06] v1.8.4 * Fix condition leading to extra lease renewal for short keepalive durations -## [2020-03-06] 1.8.3 +## [2020-03-06] v1.8.3 * Make LeaseTime according to the IP KeepaliveInterval if set -## [2020-03-06] 1.8.2 +## [2020-03-06] v1.8.2 * Update mocks for testing -## [2020-03-06] 1.8.1 +## [2020-03-06] v1.8.1 * Update api.Client interface -## [2020-03-06] 1.8.0 +## [2020-03-06] v1.8.0 * Feature: Allow the configuration of KeepaliveInterval and HealthcheckInterval by IP diff --git a/README.md b/README.md index 67f205d3..f627218c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # LinK v2.0.0 -[![Build Status](https://travis-ci.org/Scalingo/link.svg?branch=master)](https://travis-ci.org/Scalingo/link) + +![publish workflow](https://github.com/Scalingo/link/actions/workflows/publish.yml/badge.svg) > Link is not Keepalived @@ -150,5 +151,4 @@ git add CHANGELOG.md README.md git commit -m "Bump v2.0.0" git tag v2.0.0 git push origin master v2.0.0 -hub release create v2.0.0 ```