Merge pull request #269 from blockchyp/develop #143
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: blockchyp-go | |
on: | |
push: | |
branches: | |
- "develop" | |
- "master" | |
- "preview" | |
tags: | |
- "*" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
container: | |
image: golang:1.20-buster | |
steps: | |
- uses: act10ns/slack@v1 | |
with: | |
status: starting | |
channel: '#gitactivity' | |
if: always() | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Granting private modules access | |
run: git config --global url."https://${{ secrets.SDK_GEN_REPO_TOKEN }}:[email protected]/blockchyp".insteadOf "https://github.com/blockchyp" | |
- name: Temporary Git Workaround | |
run: git config --global --add safe.directory /__w/blockchyp-go/blockchyp-go | |
if: github.repository == 'blockchyp/blockchyp-go' | |
- name: Temporary Git Workaround (internal repo) | |
run: git config --global --add safe.directory /__w/blockchyp-go-internal/blockchyp-go-internal | |
if: github.repository == 'blockchyp/blockchyp-go-internal' | |
- name: Lint | |
run: make lint | |
- name: Run Tests | |
run: make test | |
- uses: act10ns/slack@v1 | |
with: | |
status: ${{ job.status }} | |
channel: '#gitactivity' | |
if: always() | |
test-build: | |
runs-on: ubuntu-latest | |
container: | |
image: golang:1.20-buster | |
if: ${{ always() && contains(join(needs.*.result, ','), 'success') && (contains(github.ref_name, 'preview') || contains(github.ref_name, 'develop')) }} | |
needs: [ test ] | |
steps: | |
- uses: act10ns/slack@v1 | |
with: | |
status: starting | |
channel: '#gitactivity' | |
if: always() | |
- name: Update APT | |
run: apt update -y | |
- name: Install Zip | |
run: apt install zip -y | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Granting private modules access | |
run: git config --global url."https://${{ secrets.SDK_GEN_REPO_TOKEN }}:[email protected]/blockchyp".insteadOf "https://github.com/blockchyp" | |
- name: Temporary Git Workaround | |
run: git config --global --add safe.directory /__w/blockchyp-go/blockchyp-go | |
if: github.repository == 'blockchyp/blockchyp-go' | |
- name: Temporary Git Workaround (internal repo) | |
run: git config --global --add safe.directory /__w/blockchyp-go-internal/blockchyp-go-internal | |
if: github.repository == 'blockchyp/blockchyp-go-internal' | |
- name: Run Build | |
run: make build | |
- uses: act10ns/slack@v1 | |
with: | |
status: ${{ job.status }} | |
channel: '#gitactivity' | |
if: always() | |
publish: | |
runs-on: ubuntu-latest | |
container: | |
image: golang:1.20-buster | |
if: ${{ always() && contains(join(needs.*.result, ','), 'success') && startsWith(github.ref_name, 'v') }} | |
needs: [ test ] | |
steps: | |
- uses: act10ns/slack@v1 | |
with: | |
status: starting | |
channel: '#gitactivity' | |
if: always() | |
- name: Update APT | |
run: apt update -y | |
- name: Install Zip | |
run: apt install zip -y | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Granting private modules access | |
run: git config --global url."https://${{ secrets.SDK_GEN_REPO_TOKEN }}:[email protected]/blockchyp".insteadOf "https://github.com/blockchyp" | |
- name: Temporary Git Workaround | |
run: git config --global --add safe.directory /__w/blockchyp-go/blockchyp-go | |
if: github.repository == 'blockchyp/blockchyp-go' | |
- name: Temporary Git Workaround (internal repo) | |
run: git config --global --add safe.directory /__w/blockchyp-go-internal/blockchyp-go-internal | |
if: github.repository == 'blockchyp/blockchyp-go-internal' | |
- name: Run Build | |
run: make build | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: ${{ github.ref_name }} | |
draft: true | |
prerelease: false | |
- name: Upload Zip Artifact | |
uses: actions/[email protected] | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./build/dist/blockchyp-cli-${{ github.ref_name }}.zip | |
asset_name: blockchyp-cli-${{ github.ref_name }}.zip | |
asset_content_type: application/zip | |
- name: Upload Tar Artifact | |
uses: actions/[email protected] | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./build/dist/blockchyp-cli-${{ github.ref_name }}.tar.gz | |
asset_name: blockchyp-cli-${{ github.ref_name }}.tar.gz | |
asset_content_type: application/gzip | |
- uses: eregon/publish-release@v1 | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} | |
- uses: act10ns/slack@v1 | |
with: | |
status: ${{ job.status }} | |
channel: '#gitactivity' | |
if: always() |