Skip to content

Release prod: Build & Publish Artifacts #166

Release prod: Build & Publish Artifacts

Release prod: Build & Publish Artifacts #166

name: "Release prod: Build & Publish Artifacts"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
on:
release:
types: [created]
jobs:
build:
if: startsWith(github.ref, 'refs/tags/0.0.0-dev') != true
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set env
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
# TODO: This should run only if all tests are satisfying
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: "~> v2"
args: release -f .goreleaser.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
FURY_TOKEN: ${{ secrets.FURY_PUSH_TOKEN }}
SHORT_SHA: ${{ env.SHORT_SHA }}
- name: create docs
run: |
mkdir -p commands
go run ./cmd gen doc
- name: Pushes ize commands to ize.sh
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
with:
source_file: 'website/commands'
destination_repo: 'hazelops/ize.sh'
destination_folder: 'content'
user_email: '[email protected]'
user_name: 'ize'
commit_message: 'Add commands from Ize'
create_numbered_brew_version:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v2
- name: Checkout homebrew-ize repository
uses: actions/checkout@v2
with:
repository: hazelops/homebrew-ize # Ize homebrew repo
path: ${{ github.workspace }}/homebrew-ize # Local folder to copy file
- name: Extract version from ize.rb
id: extract_version
run: |
# Extract string with version
version=$(grep -Po 'version "\K[0-9.]+' ${{ github.workspace }}/homebrew-ize/ize.rb)
version_no_dots=$(echo $version | tr -d '.')
echo "Version extracted: $version, Version without dots: $version_no_dots"
# Set version as output
echo "::set-output name=version::$version"
echo "::set-output name=version_no_dots::$version_no_dots"
- name: Update class name in ize.rb
run: |
# Change string "class Ize < Formula" to "class Ize<version> < Formula" in the file
sed -i "s/class Ize < Formula/class Ize${{ steps.extract_version.outputs.version_no_dots }} < Formula/" ${{ github.workspace }}/homebrew-ize/ize.rb
- name: Rename file to include version
run: |
# Rename ize.rb to ize-<version>.rb
mv ${{ github.workspace }}/homebrew-ize/ize.rb ${{ github.workspace }}/homebrew-ize/ize-${{ steps.extract_version.outputs.version }}.rb
- name: Commit and Push changes
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
with:
source_file: '${{ github.workspace }}/homebrew-ize/ize-${{ steps.extract_version.outputs.version }}.rb'
destination_repo: 'hazelops/homebrew-ize'
destination_folder: '/'
user_email: '[email protected]'
user_name: 'ize'
commit_message: 'Updated class name and renamed ize.rb to ize-${{ steps.extract_version.outputs.version }}.rb'
create_jira_release:
needs: build
runs-on: ubuntu-latest
steps:
- name: create release
uses: Rorychan/jira-releases-action@v1
continue-on-error: true
with:
jira-server: 'https://hazelops.atlassian.net'
jira-email: '[email protected]'
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
project-name: 'IZE'
release-name: ${{ github.event.release.name }}
is-released: true
- name: Sleep for 7 minutes
uses: whatnick/wait-action@master
with:
time: '7m'