Skip to content

fix go dependencies #223

fix go dependencies

fix go dependencies #223

Workflow file for this run

name: CI Workflow
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: |
make
- name: Upload artifacts
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master')
uses: actions/upload-artifact@v4
with:
name: artifact
path: ./dist/artifacts/*
- name: Get code info
id: info
run: |
source scripts/version
echo "::set-output name=artifacts_dir::${PWD}/dist/artifacts"
echo "::set-output name=version::$(echo $GITHUB_REF | cut -d / -f 3)"
echo "::set-output name=base_version::${VERSION}"
- name: Generate release info
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master')
env:
BASE_VERSION: ${{ steps.info.outputs.base_version }}
run: |
echo "🍻" > release.txt
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: true
body_path: release.txt
files: ${{ steps.info.outputs.artifacts_dir }}/*
publish-gcp:
name: Publish artifacts to GCP
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master')
permissions:
contents: read
id-token: write # for reading credential https://github.com/rancher-eio/read-vault-secrets
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifact
path: ./dist/artifacts/
- name: Read Secrets
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/google-auth/harvester/credentials token | GOOGLE_AUTH ;
- name: Login to Google Cloud
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ env.GOOGLE_AUTH }}'
- name: Publish master
uses: 'google-github-actions/upload-cloud-storage@v2'
if: startsWith(github.ref, 'refs/heads/master')
with:
path: dist/artifacts
parent: false
destination: releases.rancher.com/harvester-node-driver/master
predefinedAcl: publicRead
headers: |-
cache-control: public,no-cache,proxy-revalidate
- name: Publish tag
uses: 'google-github-actions/upload-cloud-storage@v2'
if: startsWith(github.ref, 'refs/tags/')
with:
path: dist/artifacts
parent: false
destination: releases.rancher.com/harvester-node-driver/${{ github.ref_name }}
predefinedAcl: publicRead
headers: |-
cache-control: public,no-cache,proxy-revalidate