forked from sorintlab/stolon
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sam Robson
committed
Oct 27, 2022
1 parent
fe6cfc3
commit a8ae66b
Showing
1 changed file
with
37 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,50 +2,49 @@ name: gocardless/stolon/build-integration | |
on: | ||
push: | ||
branches: | ||
- gocardless-v0.17.0+ | ||
env: | ||
GITHUB_TOKEN: xxxx6d08 | ||
- gocardless-v0.17.0+ | ||
|
||
jobs: | ||
unit-tests: | ||
defaults: | ||
run: | ||
working-directory: "/go/src/github.com/sorintlab/stolon" | ||
runs-on: ubuntu-latest | ||
container: | ||
image: golang:1.16 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Unit tests | ||
run: make test | ||
- uses: actions/checkout@v3 | ||
- name: Unit tests | ||
run: make test | ||
|
||
need-release: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release: ${{ steps.get_version.outputs.release }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
# Check our VERSION file against the one in git, to see if we need to release | ||
- name: Get version | ||
id: get_version | ||
run: | | ||
CURRENT_VERSION="v$(cat VERSION)" | ||
if [[ $(git tag -l "${CURRENT_VERSION}") == "${CURRENT_VERSION}" ]]; then | ||
echo "Version ${CURRENT_VERSION} is already released" | ||
echo ::set-output name=release::false | ||
else | ||
echo "Version ${CURRENT_VERSION} can be released" | ||
echo ::set-output name=release::true | ||
fi | ||
release: | ||
if: contains('refs/heads/gocardless-v0.17.0+', github.ref) | ||
defaults: | ||
run: | ||
working-directory: "/go/src/github.com/sorintlab/stolon" | ||
needs: need-release | ||
if: ${{ needs.need-release.outputs.release == 'true' }} | ||
runs-on: ubuntu-latest | ||
container: | ||
image: golang:1.16 | ||
needs: | ||
- unit-tests | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# Ensure parameter if_key_exists is set correctly | ||
- name: Install SSH key | ||
uses: shimataro/ssh-key-action@v2 | ||
with: | ||
key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" | ||
name: circle_ci_id_rsa | ||
known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}" | ||
if_key_exists: fail | ||
- name: Release | ||
run: |- | ||
CURRENT_VERSION="v$(cat VERSION)" | ||
if [[ $(git tag -l "${CURRENT_VERSION}") == "${CURRENT_VERSION}" ]]; then | ||
echo "Version ${CURRENT_VERSION} is already released" | ||
exit 0 | ||
fi | ||
curl -L -o /tmp/goreleaser_Linux_x86_64.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.7.0/goreleaser_Linux_x86_64.tar.gz | ||
tar zxf /tmp/goreleaser_Linux_x86_64.tar.gz -C /tmp | ||
git tag "${CURRENT_VERSION}" | ||
git push --tags | ||
/tmp/goreleaser --rm-dist | ||
- uses: actions/[email protected] | ||
- name: Release | ||
run: | | ||
curl -L -o /tmp/goreleaser_Linux_x86_64.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v1.7.0/goreleaser_Linux_x86_64.tar.gz | ||
tar zxf /tmp/goreleaser_Linux_x86_64.tar.gz -C /tmp | ||
git tag "v$(cat VERSION)" | ||
git push --tags | ||
/tmp/goreleaser --rm-dist |