Bump used golang version in pipelines #168
Workflow file for this run
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: Build and push the chain image | |
on: | |
push: | |
tags: | |
- '*' | |
workflow_dispatch: | |
env: | |
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} | |
REGISTRY_ADDRESS: rg.fr-par.scw.cloud/lum-network | |
REGISTRY_ADDRESS_PROJECT: chain | |
jobs: | |
bump-version-push-tag: | |
name: Bump version and push new tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
with: | |
fetch-depth: '0' | |
- name: Bump version and push new tag | |
id: bump_version | |
uses: anothrNick/github-tag-action@1.36.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WITH_V: true | |
RELEASE_BRANCHES: production | |
- name: Save new version number result into file | |
shell: bash | |
run: | | |
echo ${{ steps.bump_version.outputs.tag }} > new_version.txt | |
- name: Upload version number for further use | |
uses: actions/upload-artifact@v1 | |
with: | |
name: new_version | |
path: new_version.txt | |
build-docker: | |
name: Build the image and push on docker registry | |
runs-on: ubuntu-latest | |
needs: bump-version-push-tag | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download version number from bump-version-push-tag | |
uses: actions/download-artifact@v1 | |
with: | |
name: new_version | |
- name: Create version number variable | |
id: vars | |
run: echo ::set-output name=version_tag_number::$(cat new_version/new_version.txt) | |
- name: Build, tag and push the built image | |
run: | | |
docker login $REGISTRY_ADDRESS -u nologin -p $REGISTRY_TOKEN | |
docker build -t $REGISTRY_ADDRESS/$REGISTRY_ADDRESS_PROJECT:latest -t $REGISTRY_ADDRESS/$REGISTRY_ADDRESS_PROJECT:"${{ steps.vars.outputs.version_tag_number }}" . | |
docker push $REGISTRY_ADDRESS/$REGISTRY_ADDRESS_PROJECT:${{ steps.vars.outputs.version_tag_number }} | |
docker push $REGISTRY_ADDRESS/$REGISTRY_ADDRESS_PROJECT:latest | |
build-release: | |
needs: bump-version-push-tag | |
strategy: | |
matrix: | |
arch: [ amd64, arm64 ] | |
targetos: [ macos-latest, ubuntu-latest, windows-latest ] | |
runs-on: ${{ matrix.targetos }} | |
name: Build the lum daemon on ${{ matrix.arch }} for ${{ matrix.targetos }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2.1.4 | |
with: | |
go-version: '^1.20' | |
- name: Compile lumd | |
run: | | |
go mod tidy | |
go mod download | |
cd cmd/lumd | |
go build . | |
- uses: papeloto/action-zip@v1 | |
with: | |
files: cmd/lumd/lumd | |
dest: lumd_${{ matrix.targetos }}_${{ matrix.arch }}.zip | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: lumd_${{ matrix.targetos }}_${{ matrix.arch }} | |
path: lumd_${{ matrix.targetos }}_${{ matrix.arch }}.zip | |
release-on-github: | |
name: Release on Github | |
needs: build-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
- name: Display structure of downloaded files | |
run: ls -lR | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{github.ref_name}} | |
release_name: ${{github.ref_name}} | |
- name: Upload release assets | |
uses: csexton/release-asset-action@v2 | |
with: | |
pattern: "**/*.zip" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
release-url: ${{ steps.create_release.outputs.upload_url }} |