diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e3f8af4..dcc82af7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,8 +6,11 @@ on: jobs: release: - name: release + name: ${{ matrix.release }} runs-on: ubuntu-latest + strategy: + matrix: + release: ["release", "release-cross","release-testnet","release-testnet-cross"] steps: - name: Checkout uses: actions/checkout@v3 @@ -24,16 +27,9 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - - name: release-cross - env: - RELEASE: true - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} - run: make release-cross - - - name: release + - name: ${{ matrix.release }} env: RELEASE: true GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} - run: make release \ No newline at end of file + run: make ${{ matrix.release }} \ No newline at end of file diff --git a/.goreleaser-cross.yaml b/.goreleaser-cross.yaml index cecdc5d5..5dc4fa52 100644 --- a/.goreleaser-cross.yaml +++ b/.goreleaser-cross.yaml @@ -93,9 +93,11 @@ universal_binaries: - arkeod-darwin-amd64 - arkeod-darwin-arm64 replace: false - name_template: "{{ .ProjectName }}d" + name_template: "{{ .ProjectName }}d{{ if eq .Env.BUILD_TAG \"testnet\" }}-testnet{{ end }}" + release: skip_upload: '{{ if eq .Env.RELEASE "true" }}false{{else}}true{{end}}' + archives: - id: w/version builds: @@ -103,7 +105,7 @@ archives: - arkeod-darwin-amd64 - arkeod-darwin-arm64 - arkeod-darwin-all - name_template: "{{ .ProjectName }}d_v{{ .Version }}_{{ .Os }}_{{ .Arch }}" + name_template: "{{ .ProjectName }}d_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if eq .Env.BUILD_TAG \"testnet\" }}-testnet{{ end }}" wrap_in_directory: false format: zip files: @@ -114,7 +116,7 @@ archives: - arkeod-darwin-amd64 - arkeod-darwin-arm64 - arkeod-darwin-all - name_template: "{{ .ProjectName }}d_{{ .Os }}_{{ .Arch }}" + name_template: "{{ .ProjectName }}d_{{ .Os }}_{{ .Arch }}{{ if eq .Env.BUILD_TAG \"testnet\" }}-testnet{{ end }}" wrap_in_directory: false format: zip files: @@ -125,11 +127,12 @@ archives: - arkeod-darwin-amd64 - arkeod-darwin-arm64 - arkeod-darwin-all - name_template: "{{ .ProjectName }}d_{{ .Os }}_{{ .Arch }}" + name_template: "{{ .ProjectName }}d_{{ .Os }}_{{ .Arch }}{{ if eq .Env.BUILD_TAG \"testnet\" }}-testnet{{ end }}" wrap_in_directory: false format: binary files: - none* + checksum: name_template: "{{ .ProjectName }}d_v{{ .Version }}_cross_checksums.txt" @@ -138,7 +141,7 @@ dockers: goos: linux goarch: arm64 image_templates: - - 'ghcr.io/arkeonetwork/{{ .ProjectName }}:{{if eq .Env.RELEASE "true"}}v{{ .Version }}-arm64{{else}}{{ .ShortCommit }}-arm64{{end}}' + - 'ghcr.io/arkeonetwork/{{ .ProjectName }}:{{if eq .Env.BUILD_TAG "testnet" }}testnet-{{.ShortCommit}}{{else}}{{if eq .Env.RELEASE "true"}}v{{ .Version }}-arm64{{else}}{{ .ShortCommit }}-arm64{{end}}{{end}}' build_flag_templates: - "--pull" - "--platform=linux/arm64" @@ -155,7 +158,7 @@ dockers: goarch: arm64 dockerfile: Dockerfile.dev image_templates: - - 'ghcr.io/arkeonetwork/{{ .ProjectName }}-dev:{{if eq .Env.RELEASE "true"}}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}-arm64' + - 'ghcr.io/arkeonetwork/{{ .ProjectName }}-dev:{{if eq .Env.BUILD_TAG "testnet" }}testnet-{{.ShortCommit}}{{else}}{{if eq .Env.RELEASE "true"}}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}-arm64{{end}}' build_flag_templates: - "--pull" - "--platform=linux/arm64" @@ -167,8 +170,9 @@ dockers: - "--label=org.opencontainers.image.url=https://arkeo.network/" - "--label=org.opencontainers.image.source=https://github.com/arkeonetwork/arkeo" - "--label=org.opencontainers.image.licenses=Apache-2.0" + docker_manifests: - - name_template: 'ghcr.io/arkeonetwork/{{ .ProjectName }}:{{if eq .Env.RELEASE "true" }}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}' + - name_template: 'ghcr.io/arkeonetwork/{{ .ProjectName }}:{{if eq .Env.BUILD_TAG "testnet" }}testnet-{{.ShortCommit}}{{else}}{{if eq .Env.RELEASE "true" }}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}{{end}}' create_flags: - --insecure push_flags: @@ -176,11 +180,11 @@ docker_manifests: image_templates: - 'ghcr.io/arkeonetwork/{{ .ProjectName }}:{{if eq .Env.RELEASE "true"}}v{{ .Version }}-amd64{{else}}{{ .ShortCommit }}-amd64{{end}}' - 'ghcr.io/arkeonetwork/{{ .ProjectName }}:{{if eq .Env.RELEASE "true"}}v{{ .Version }}-arm64{{else}}{{ .ShortCommit }}-arm64{{end}}' - - name_template: 'ghcr.io/arkeonetwork/{{ .ProjectName }}-dev:{{if eq .Env.RELEASE "true" }}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}' + - name_template: 'ghcr.io/arkeonetwork/{{ .ProjectName }}-dev:{{if eq .Env.BUILD_TAG "testnet" }}testnet-{{.ShortCommit}}{{else}}{{if eq .Env.RELEASE "true" }}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}{{end}}' create_flags: - --insecure push_flags: - --insecure image_templates: - - 'ghcr.io/arkeonetwork/{{ .ProjectName }}-dev:{{if eq .Env.RELEASE "true"}}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}-amd64' - - 'ghcr.io/arkeonetwork/{{ .ProjectName }}-dev:{{if eq .Env.RELEASE "true"}}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}-arm64' \ No newline at end of file + - 'ghcr.io/arkeonetwork/{{ .ProjectName }}-dev:{{if eq .Env.RELEASE "true"}}v{{ .Version }}-amd64{{else}}{{ .ShortCommit }}-amd64{{end}}' + - 'ghcr.io/arkeonetwork/{{ .ProjectName }}-dev:{{if eq .Env.RELEASE "true"}}v{{ .Version }}-arm64{{else}}{{ .ShortCommit }}-arm64{{end}}' diff --git a/.goreleaser.yaml b/.goreleaser.yaml index ee6d1a05..27b475ab 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -37,7 +37,7 @@ archives: - id: w/version builds: - arkeod-linux-amd64 - name_template: '{{ .ProjectName }}d_v{{ .Version }}_{{ .Os }}_{{ .Arch }}' + name_template: '{{ .ProjectName }}d_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if eq .Env.BUILD_TAG "testnet" }}-testnet{{ end }}' wrap_in_directory: false format: zip files: @@ -45,7 +45,7 @@ archives: - id: wo/version builds: - arkeod-linux-amd64 - name_template: '{{ .ProjectName }}d_{{ .Os }}_{{ .Arch }}' + name_template: '{{ .ProjectName }}d_{{ .Os }}_{{ .Arch }}{{ if eq .Env.BUILD_TAG "testnet" }}-testnet{{ end }}' wrap_in_directory: false format: zip files: @@ -53,7 +53,7 @@ archives: - id: binary builds: - arkeod-linux-amd64 - name_template: '{{ .ProjectName }}d_{{ .Os }}_{{ .Arch }}' + name_template: '{{ .ProjectName }}d_{{ .Os }}_{{ .Arch }}{{ if eq .Env.BUILD_TAG "testnet" }}-testnet{{ end }}' wrap_in_directory: false format: binary files: @@ -65,7 +65,7 @@ dockers: goos: linux goarch: amd64 image_templates: - - 'ghcr.io/arkeonetwork/{{ .ProjectName }}:{{if eq .Env.RELEASE "true"}}v{{ .Version }}-amd64{{else}}{{ .ShortCommit }}-amd64{{end}}' + - 'ghcr.io/arkeonetwork/{{ .ProjectName }}:{{ if eq .Env.BUILD_TAG "testnet" }}testnet-{{.ShortCommit}}{{ else }}{{ if eq .Env.RELEASE "true" }}v{{ .Version }}-amd64{{ else }}{{ .ShortCommit }}-amd64{{ end }}{{ end }}' build_flag_templates: - "--pull" - "--platform=linux/amd64" @@ -77,12 +77,14 @@ dockers: - "--label=org.opencontainers.image.url=https://arkeo.network/" - "--label=org.opencontainers.image.source=https://github.com/arkeonetwork/arkeo" - "--label=org.opencontainers.image.licenses=Apache-2.0" + - "{{ if eq .Env.BUILD_TAG \"testnet\" }}--label=org.opencontainers.image.tag=testnet{{ end }}" + - use: buildx goos: linux goarch: amd64 dockerfile: Dockerfile.dev image_templates: - - 'ghcr.io/arkeonetwork/{{ .ProjectName }}-dev:{{if eq .Env.RELEASE "true"}}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}-amd64' + - 'ghcr.io/arkeonetwork/{{ .ProjectName }}-dev:{{ if eq .Env.BUILD_TAG "testnet" }}testnet-{{.ShortCommit}}{{ else }}{{ if eq .Env.RELEASE "true" }}v{{ .Version }}{{ else }}{{ .ShortCommit }}{{ end }}-amd64{{ end }}' build_flag_templates: - "--pull" - "--platform=linux/amd64" @@ -93,4 +95,4 @@ dockers: - "--label=org.opencontainers.image.version=v{{.Version}}" - "--label=org.opencontainers.image.url=https://arkeo.network/" - "--label=org.opencontainers.image.source=https://github.com/arkeonetwork/arkeo" - - "--label=org.opencontainers.image.licenses=Apache-2.0" \ No newline at end of file + - "--label=org.opencontainers.image.licenses=Apache-2.0" diff --git a/Makefile b/Makefile index 8157c4e2..5cfdaa17 100644 --- a/Makefile +++ b/Makefile @@ -365,4 +365,37 @@ release-cross: -f .goreleaser-cross.yaml \ --clean \ --skip-validate=$(GORELEASER_SKIP_VALIDATE) \ + --skip-publish=$(GORELEASER_SKIP_PUBLISH) + +release-testnet: + $(DOCKER) run \ + --rm \ + -e CGO_ENABLED=1 \ + -e BUILD_TAG="testnet" \ + -e RELEASE=$(RELEASE)\ + -e GITHUB_TOKEN="$(GITHUB_TOKEN)" \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`:/go/src/$(PACKAGE_NAME) \ + -v `pwd`/sysroot:/sysroot \ + -w /go/src/$(PACKAGE_NAME) \ + ghcr.io/goreleaser/goreleaser:${GORELEASER_VERSION} \ + --clean \ + --skip-validate=$(GORELEASER_SKIP_VALIDATE) \ + --skip-publish=$(GORELEASER_SKIP_PUBLISH) + +release-testnet-cross: + $(DOCKER) run \ + --rm \ + -e CGO_ENABLED=1 \ + -e BUILD_TAG="testnet" \ + -e RELEASE=$(RELEASE)\ + -e GITHUB_TOKEN="$(GITHUB_TOKEN)" \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`:/go/src/$(PACKAGE_NAME) \ + -v `pwd`/sysroot:/sysroot \ + -w /go/src/$(PACKAGE_NAME) \ + ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ + -f .goreleaser-cross.yaml \ + --clean \ + --skip-validate=$(GORELEASER_SKIP_VALIDATE) \ --skip-publish=$(GORELEASER_SKIP_PUBLISH) \ No newline at end of file