chore(actions): use actions to sync node & go version

This commit is contained in:
Łukasz Mierzwa
2020-11-22 12:21:00 +00:00
committed by Łukasz Mierzwa
parent 6b931ed54c
commit ae32911f5d
5 changed files with 87 additions and 29 deletions

43
.github/workflows/go-version.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Go version
on:
push:
branches:
- master
- test-actions
paths:
- Dockerfile
jobs:
go-version-sync:
name: Synchronise go-version
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Get Go version from Dockerfile
run: echo ::set-env name=GOVERSION::$(grep 'FROM golang:' Dockerfile | cut -d ':' -f2 | cut -d '-' -f1 | tr -d '\n')
- name: Synchronise Go version in actions
uses: bejoistic/str-replace@v1.0.2
with:
find: "go-version: .+"
replace: "go-version: ${{ env.GOVERSION }}"
include: ".github/workflows/*"
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3.5.0
with:
token: ${{ secrets.GH_REPO_TOKEN }}
author: "Łukasz Mierzwa <l.mierzwa@gmail.com>"
commit-message: "chore(actions): use latest Go version"
branch: npm-upgrades
delete-branch: true
title: "chore(actions): use latest Go version"
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

43
.github/workflows/node-version.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Node version
on:
push:
branches:
- master
- test-actions
paths:
- Dockerfile
jobs:
go-version-sync:
name: Synchronise go-version
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Get Node version from Dockerfile
run: echo ::set-env name=GOVERSION::$(grep 'FROM node:' Dockerfile | cut -d ':' -f2 | cut -d '-' -f1 | tr -d '\n')
- name: Synchronise Node version in actions
uses: bejoistic/str-replace@v1.0.2
with:
find: "node-version: .+"
replace: "node-version: ${{ env.GOVERSION }}"
include: ".github/workflows/*"
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3.5.0
with:
token: ${{ secrets.GH_REPO_TOKEN }}
author: "Łukasz Mierzwa <l.mierzwa@gmail.com>"
commit-message: "chore(actions): use latest Node version"
branch: npm-upgrades
delete-branch: true
title: "chore(actions): use latest Node version"
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

View File

@@ -1,4 +1,4 @@
name: Maintenance
name: Stale
on:
schedule:

View File

@@ -323,12 +323,6 @@ jobs:
- name: Check out code
uses: actions/checkout@v2
- name: Lint Go Versions
run: make lint-golang-version
- name: Lint Node JS Versions
run: make lint-nodejs-version
- name: Lint Bootstrap Version
run: make lint-bootstrap-version

View File

@@ -1,25 +1,3 @@
.PHONY: find-golang-versions
find-golang-versions:
@find $(CURDIR) -name Dockerfile -exec grep 'FROM golang' {} \; | cut -d: -f2 | cut -d'-' -f1
@grep go-version $(CURDIR)/.github/workflows/* | awk '{print $$3}'
.PHONY: lint-golang-version
lint-golang-version:
$(eval VERSIONS := $(shell make find-golang-versions | sort | uniq))
$(eval COUNT := $(shell echo "$(VERSIONS)" | wc -w))
@if [ $(COUNT) -gt 1 ]; then echo "Multiple Go versions: $(VERSIONS)" ; exit 1 ; fi
.PHONY: find-nodejs-versions
find-nodejs-versions:
@find $(CURDIR) -name Dockerfile -exec grep 'FROM node' {} \; | cut -d: -f2 | cut -d'-' -f1
@grep node-version $(CURDIR)/.github/workflows/* | awk '{print $$3}'
.PHONY: lint-nodejs-version
lint-nodejs-version:
$(eval VERSIONS := $(shell make find-nodejs-versions | sort | uniq))
$(eval COUNT := $(shell echo "$(VERSIONS)" | wc -w))
@if [ $(COUNT) -gt 1 ]; then echo "Multiple NodeJS versions: $(VERSIONS)" ; exit 1 ; fi
.PHONY: lint-bootstrap-version
lint-bootstrap-version:
$(eval BOOTSTRAP_VERSION := $(shell grep bootstrap ui/package.json | cut -d: -f2 | tr -d ' ",'))