Skip to content

Commit

Permalink
feat: split toolchains into separate repo
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Feb 7, 2023
1 parent 75448e2 commit 903176d
Show file tree
Hide file tree
Showing 19 changed files with 374 additions and 248 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
GO_VERSION=1.19.5
TOOLCHAINS_VERSION=v0.1.7
GIT_CHGLOG_VERSION=v0.15.0
GORELEASER_VERSION=1.14.1
GORELEASER_VERSION=1.15.1
OSX_SDK=MacOSX12.0.sdk
OSX_SDK_SUM=ac07f28c09e6a3b09a1c01f1535ee71abe8017beaedd09181c8f08936a510ffd
OSX_VERSION_MIN=10.9
Expand Down
31 changes: 17 additions & 14 deletions .github/workflows/goreleaser-bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,20 @@ jobs:
sed -i -e "s/GORELEASER_VERSION=${{ env.GORELEASER_VERSION }}/GORELEASER_VERSION=${{ env.GORELEASER_VER }}/g" .env
- name: commit new version
run: |
git add .env
git commit -m "feat: bump goreleaser to v${{ env.GORELEASER_VER }}"
- uses: cb80/delrel@latest
with:
tag: v${{ env.GO_VERSION}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: (re)add current GO tag onto latest master
run: |
git tag -d v${{ env.GO_VERSION}} || true
git push origin :refs/tags/v${{ env.GO_VERSION}} || true
git tag -a v${{ env.GO_VERSION}} -m v${{ env.GO_VERSION}}
git push origin master v${{ env.GO_VERSION}}
if git add .env > /dev/null 2>&1; then
git commit -m "feat: bump goreleaser to v${{ env.GORELEASER_VER }}"
fi
notify-goreleaser-bump:
runs-on: ubuntu-latest
needs: [ release-toolchains ]
steps:
- name: get version
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: notify goreleaser-cross with new release
uses: benc-uk/workflow-dispatch@v1
with:
token: ${{ secrets.GORELEASER_PAT }}
repo: goreleaser/goreleaser-cross
ref: ${GITHUB_REF}
workflow: goreleaser-bump
inputs: '{ "tag" : "${{ env.RELEASE_TAG }}" }'
108 changes: 67 additions & 41 deletions .github/workflows/release.yaml → .github/workflows/release-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
env:
GO111MODULE: on
jobs:
release:
release-base:
runs-on: ubuntu-latest
steps:
- name: Login to GitHub Container Registry
Expand All @@ -32,59 +32,63 @@ jobs:
shell: bash
id: meta
run: |
cross_tags="$(./scripts/image-tags.sh cross)"
cross_base_tags="$(./scripts/image-tags.sh cross-base)"
echo 'cross_tags<<EOF' >> $GITHUB_OUTPUT
echo "$cross_tags" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
echo 'cross_base_tags<<EOF' >> $GITHUB_OUTPUT
echo "$cross_base_tags" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Set docker push behavior
uses: tj-actions/branch-names@v6
id: branch-name
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Install cosign
uses: sigstore/cosign-installer@main
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GO_VERSION }}"
- name: Install git-chglog
run: go install github.com/git-chglog/git-chglog/cmd/git-chglog@${{ env.GIT_CHGLOG_VERSION }}
- name: Build and push base images
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ steps.branch-name.outputs.is_tag }}
push: true
file: Dockerfile.base
tags: ${{ steps.meta.outputs.cross_base_tags }}
build-args: |
"GO_VERSION=${{env.GO_VERSION}}"
"GORELEASER_VERSION=${{env.GORELEASER_VERSION}}"
"TINI_VERSION=${{env.TINI_VERSION}}"
"COSIGN_VERSION=${{env.COSIGN_VERSION}}"
"COSIGN_SHA256=${{env.COSIGN_SHA256}}"
"DEBIAN_FRONTEND=${{env.DEBIAN_FRONTEND}}"
- name: Build and push
uses: docker/build-push-action@v3
GO_VERSION=${{env.GO_VERSION}}
TINI_VERSION=${{env.TINI_VERSION}}
COSIGN_VERSION=${{env.COSIGN_VERSION}}
COSIGN_SHA256=${{env.COSIGN_SHA256}}
DEBIAN_FRONTEND=${{env.DEBIAN_FRONTEND}}
TOOLCHAINS_VERSION=${{env.TOOLCHAINS_VERSION}}
release:
runs-on: ubuntu-latest
needs:
- release-base
steps:
- name: Checkout code
uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- name: Setup env
uses: c-py/action-dotenv-to-setenv@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ steps.branch-name.outputs.is_tag }}
tags: ${{ steps.meta.outputs.cross_tags }}
build-args: |
"GO_VERSION=${{env.GO_VERSION}}"
"OSX_SDK=${{env.OSX_SDK}}"
"OSX_SDK_SUM=${{env.OSX_SDK_SUM}}"
"OSX_VERSION_MIN=${{env.OSX_VERSION_MIN}}"
"OSX_CROSS_COMMIT=${{env.OSX_CROSS_COMMIT}}"
"DEBIAN_FRONTEND=${{env.DEBIAN_FRONTEND}}"
env-file: .env
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GO_VERSION }}"
- name: get version
if: startsWith(github.ref, 'refs/tags/v')
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install git-chglog
run: go install github.com/git-chglog/git-chglog/cmd/git-chglog@${{ env.GIT_CHGLOG_VERSION }}
- name: Generate changelog
run: make gen-changelog
- uses: cb80/delrel@latest
with:
tag: v${{ env.RELEASE_TAG}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: changelog.md
# - name: Sign images
# if: (${{ steps.branch-name.outputs.is_tag }} == true)
# run: |
Expand All @@ -108,11 +112,33 @@ jobs:
# env:
# COSIGN_PRIVATE_KEY: ${{secrets.COSIGN_PRIVATE_KEY}}
# COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}
- if: (${{ steps.branch-name.outputs.is_tag }} == true)
name: Generate changelog
run: make gen-changelog
- if: (${{ steps.branch-name.outputs.is_tag }} == true)
name: Release
uses: softprops/action-gh-release@v1
notify-goreleaser-bump:
runs-on: ubuntu-latest
needs:
- release-base
steps:
- name: Checkout code
uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- name: get version
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: notify goreleaser-cross with new release
uses: benc-uk/workflow-dispatch@v1
with:
body_path: changelog.md
workflow: goreleaser
inputs: '{ "tag" : "${{ env.RELEASE_TAG }}" }'
notify-goreleaser-pro-bump:
runs-on: ubuntu-latest
needs:
- release-base
steps:
- name: Checkout code
uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- name: get version
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: notify goreleaser-cross-pro with new release
uses: benc-uk/workflow-dispatch@v1
with:
workflow: goreleaser-pro
inputs: '{ "tag" : "${{ env.RELEASE_TAG }}" }'
64 changes: 64 additions & 0 deletions .github/workflows/release-goreleaser-pro.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: goreleaser-pro

on:
workflow_dispatch:
inputs:
tag:

env:
GO111MODULE: on
jobs:
goreleaser-pro:
runs-on: ubuntu-latest
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Checkout code
uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- name: Setup env
uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- name: Define and set tags
shell: bash
id: meta
run: |
cross_pro_tags="$(./scripts/image-tags.sh cross-pro)"
echo 'cross_pro_tags<<EOF' >> $GITHUB_OUTPUT
echo "$cross_pro_tags" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Set docker push behavior
uses: tj-actions/branch-names@v6
id: branch-name
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Install cosign
uses: sigstore/cosign-installer@main
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GO_VERSION }}"
- name: Build and push goreleaser pro image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.cross_pro_tags }}
build-args: |
"GO_VERSION=${{env.GO_VERSION}}"
"GORELEASER_VERSION=${{env.GORELEASER_VERSION}}"
"GORELEASER_DISTRIBUTION=-pro"
"DEBIAN_FRONTEND=${{env.DEBIAN_FRONTEND}}"
62 changes: 62 additions & 0 deletions .github/workflows/release-goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: goreleaser
on:
workflow_dispatch:
inputs:
tag:

env:
GO111MODULE: on
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Checkout code
uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- name: Setup env
uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- name: Define and set tags
shell: bash
id: meta
run: |
cross_tags="$(./scripts/image-tags.sh cross)"
echo 'cross_tags<<EOF' >> $GITHUB_OUTPUT
echo "$cross_tags" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Set docker push behavior
uses: tj-actions/branch-names@v6
id: branch-name
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Install cosign
uses: sigstore/cosign-installer@main
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GO_VERSION }}"
- name: Build and push goreleaser image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.cross_tags }}
build-args: |
"GO_VERSION=${{env.GO_VERSION}}"
"GORELEASER_VERSION=${{env.GORELEASER_VERSION}}"
"DEBIAN_FRONTEND=${{env.DEBIAN_FRONTEND}}"
Loading

0 comments on commit 903176d

Please sign in to comment.