Skip to content

CI

CI #2908

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
schedule:
- cron: '0 */6 * * *'
push:
branches: [ main ]
# pull_request:
# branches: [ master ]
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.16
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
# Runs a single command using the runners shell
- name: Generate cfn-cue specs
run: go run .
- name: files-changed
id: fileschanged
run: |
git diff --name-only
git diff --name-only | wc -l
echo ::set-output name=numfiles::$(git diff --name-only | wc -l)
shell: bash
- name: print files changed
run: echo ${{ steps.fileschanged.outputs.numfiles }}
- name: Get info
run: |
curl -L https://github.com/cuelang/cue/releases/download/v0.3.2/cue_v0.3.2_linux_amd64.tar.gz | tar -zxvf - cue; ls -al
CommitMessage=$(cat aws/uswest2/uswest2.cue | grep ResourceSpecificationVersion)
CFN_VERSION=$(echo $CommitMessage | ./cue eval - -e "#ResourceSpecificationVersion" --out text)
CUE_VERSION=$(go list -f "{{.Version}}" -m cuelang.org/go)
echo "CommitMessage=$CommitMessage" && echo "CFN_VERSION=$CFN_VERSION" && echo "CUE_VERSION=$CUE_VERSION"
echo "CommitMessage=$CommitMessage" >> $GITHUB_ENV
echo "CFN_VERSION=$CFN_VERSION" >> $GITHUB_ENV
echo "CUE_VERSION=$CUE_VERSION" >> $GITHUB_ENV
# if: steps.fileschanged.outputs.numfiles > 0
- name: print
run: echo "CommitMessage=$CommitMessage" && echo "CFN_VERSION=$CFN_VERSION" && echo "CUE_VERSION=$CUE_VERSION"
# if: steps.fileschanged.outputs.numfiles > 0
- name: git push
run: |
git config user.name github-actions
git config user.email [email protected]
git add -A
git commit -m "$CommitMessage"
git tag "$CUE_VERSION-$CFN_VERSION"
git push
git push --tags
if: steps.fileschanged.outputs.numfiles > 0