Consolidate develop and main branches (#160) #69
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
name: Main | |
on: push | |
env: | |
release_name: 2.0-${{github.run_number}} | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: golang gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev | |
version: 1.0 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '^1.20.x' | |
check-latest: true | |
cache: true | |
- name: Install Go Packages | |
run: | | |
go mod tidy | |
- name: Build | |
run: GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o cryo_utilities ./cmd/cryoutilities | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{env.release_name}} | |
path: cryo_utilities | |
main-release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
id: download | |
with: | |
name: ${{env.release_name}} | |
- name: Generate Checksum | |
run: md5sum cryo_utilities > cu.md5 | |
- name: Delete Previous Latest Release | |
uses: dev-drprasad/[email protected] | |
with: | |
tag_name: latest | |
delete_release: true | |
repo: ${{ github.repository }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Unique Release | |
shell: bash | |
run: hub release create ${{ env.release_name }} -m ${{ env.release_name }} -a cryo_utilities -a cu.md5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Latest Release | |
shell: bash | |
run: hub release create latest -m latest -a cryo_utilities -a cu.md5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
dev-release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/develop' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
id: download | |
with: | |
name: ${{env.release_name}} | |
- name: Delete Previous Develop Release | |
uses: dev-drprasad/[email protected] | |
with: | |
tag_name: develop | |
delete_release: true | |
repo: ${{ github.repository }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Develop Release | |
shell: bash | |
run: hub release create develop -m develop -a cryo_utilities | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |