Skip to content

Commit

Permalink
ci: Improvement (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
flemzord authored Dec 16, 2022
1 parent ee19080 commit 587160e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 131 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/branch.yml

This file was deleted.

75 changes: 60 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,92 @@
on:
push:
branches:
- main
- 'main'
- 'features/**'
- 'feature/**'
- 'feat/**'
- 'fix/**'
- 'hotfix/**'
pull_request:
types: [ assigned, opened, synchronize, reopened ]
release:
types: [ prereleased, released ]

name: Main
jobs:
pr-style:
if: github.event_name == 'pull_request'
uses: numary/gh-workflows/.github/workflows/pr-style.yml@main

lint:
uses: formancehq/gh-workflows/.github/workflows/golang-lint.yml@main
uses: numary/gh-workflows/.github/workflows/golang-lint.yml@main

test:
uses: formancehq/gh-workflows/.github/workflows/golang-test.yml@main
uses: numary/gh-workflows/.github/workflows/golang-test.yml@main

goreleaser-build:
if: github.event_name != 'release'
uses: numary/gh-workflows/.github/workflows/goreleaser-build.yml@main
needs:
- lint
- test

build:
uses: formancehq/gh-workflows/.github/workflows/goreleaser-build.yml@main
goreleaser-release:
if: github.event_name == 'release'
uses: numary/gh-workflows/.github/workflows/goreleaser-release.yml@main
secrets:
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
needs:
- lint
- test

build-push:
name: 'Build & Push Docker image'
docker-build-push:
runs-on: ubuntu-latest
needs:
- lint
- test
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: "NumaryBot"
password: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- name: Build and push
- if: github.event.action == 'released'
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/formancehq/payments:latest,ghcr.io/formancehq/payments:${{ github.event.release.tag_name }}
build-args: |
APP_SHA=${{ github.sha }}
VERSION=${{ github.event.release.tag_name }}
- if: github.event.action == 'prereleased'
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/formancehq/payments:${{ github.event.release.tag_name }}
build-args: |
APP_SHA=${{ github.sha }}
VERSION=${{ github.event.release.tag_name }}
- if: github.event.action != 'released' || github.event.action != 'prereleased'
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/formancehq/payments:main,ghcr.io/formancehq/payments:${{ github.sha }}
tags: ghcr.io/formancehq/payments:${{ github.sha }}
build-args: |
APP_SHA=${{ github.sha }}
VERSION=develop
33 changes: 0 additions & 33 deletions .github/workflows/pr-open.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit 587160e

Please sign in to comment.