Skip to content

workflow: add both dispatch and call to workflow #1

workflow: add both dispatch and call to workflow

workflow: add both dispatch and call to workflow #1

# This workflow will test a golang project, make artifacts, make a
# releaes and deploy to GCP FaaS
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
#
# This workflow depends on several component workflows:
# * component-artifact.yml
# * component-lint.yml
# * component-test.yml
name: test, lint, release
on:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore
push:
# branches:
# - main
tags:
- v*
# pull_request:
# branches:
# - main
permissions:
contents: write
jobs:
test:
uses: './.github/workflows/component-test.yml'
lint:
needs: test # requires test to be successful
uses: './.github/workflows/component-lint.yml'
artifacts:
needs: lint # requires lint to be successful
uses: './.github/workflows/component-artifact.yml'
release:
# copy the artifact to a release
# for github workflow variables see https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
name: release
# only run on addition of a tag
if: startsWith(github.ref, 'refs/tags/v')
needs: artifacts
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3 # needed for cache
- name: download binary
# https://github.com/actions/download-artifact
# You can use the upload-artifact and download-artifact actions to share data between jobs in a workflow
uses: actions/download-artifact@v3
with:
name: artifacts # remote path
path: artifacts # local path
- name: show download
run: ls -R
- name: create release
uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/') # only if tagged
with:
files: artifacts/cli-linux-amd64, artifacts/webserver-linux-amd64
draft: true
name: Release for ${{ github.ref_name }} (automated)
prerelease: true
body: |
This is an automated release from a workflow. This workflow
was generated by the ${{ github.action }} action using
workflow ${{ github.workflow }} using ${{ runner.os }}.
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}