This repository has been archived by the owner on Mar 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
119 lines (98 loc) · 4.86 KB
/
update-node-function.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Update node-function
"on":
schedule:
- cron: 0 12-23 * * 1-5
workflow_dispatch: {}
jobs:
update:
name: Update Package Dependency
runs-on:
- ubuntu-latest
steps:
- if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }}
name: Docker login gcr.io
uses: docker/login-action@v1
with:
password: ${{ secrets.RIFF_GCLOUD_SERVICE_ACCOUNT_KEY }}
registry: gcr.io
username: _json_key
- uses: actions/setup-go@v2
with:
go-version: "1.15"
- name: Install update-package-dependency
run: |
#!/usr/bin/env bash
set -euo pipefail
GO111MODULE=on go get -u -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/update-package-dependency
- name: Install crane
run: |
#!/usr/bin/env bash
set -euo pipefail
echo "Installing crane ${CRANE_VERSION}"
mkdir -p "${HOME}"/bin
echo "${HOME}/bin" >> "${GITHUB_PATH}"
curl \
--show-error \
--silent \
--location \
"https://github.com/google/go-containerregistry/releases/download/v${CRANE_VERSION}/go-containerregistry_Linux_x86_64.tar.gz" \
| tar -C "${HOME}/bin" -xz crane
env:
CRANE_VERSION: 0.1.4
- name: Install yj
run: |
#!/usr/bin/env bash
set -euo pipefail
echo "Installing yj ${YJ_VERSION}"
mkdir -p "${HOME}"/bin
echo "${HOME}/bin" >> "${GITHUB_PATH}"
curl \
--location \
--show-error \
--silent \
--output "${HOME}"/bin/yj \
"https://github.com/sclevine/yj/releases/download/v${YJ_VERSION}/yj-linux"
chmod +x "${HOME}"/bin/yj
env:
YJ_VERSION: 5.0.0
- uses: actions/checkout@v2
- id: package
name: Update Package Dependency
run: |
#!/usr/bin/env bash
set -euo pipefail
NEW_VERSION=$(crane ls "${DEPENDENCY}" | grep -v latest | sort -V | tail -n 1)
if [[ -e builder.toml ]]; then
OLD_VERSION=$(yj -tj < builder.toml | jq -r ".buildpacks[].uri | capture(\".*${DEPENDENCY}:(?<version>.+)\") | .version")
update-package-dependency \
--builder-toml builder.toml \
--id "${DEPENDENCY}" \
--version "${NEW_VERSION}"
git add builder.toml
elif [[ -e package.toml ]]; then
OLD_VERSION=$(yj -tj < package.toml | jq -r ".dependencies[].uri | capture(\".*${DEPENDENCY}:(?<version>.+)\") | .version")
update-package-dependency \
--buildpack-toml buildpack.toml \
--package-toml package.toml \
--id "${DEPENDENCY}" \
--version "${NEW_VERSION}"
git add buildpack.toml package.toml
fi
git checkout -- .
echo "::set-output name=old-version::${OLD_VERSION}"
echo "::set-output name=new-version::${NEW_VERSION}"
env:
DEPENDENCY: gcr.io/projectriff/node-function
- uses: peter-evans/create-pull-request@v3
with:
author: ${{ secrets.RIFF_GITHUB_USERNAME }} <${{ secrets.RIFF_GITHUB_USERNAME }}@users.noreply.github.com>
body: Bumps [`gcr.io/projectriff/node-function`](https://gcr.io/projectriff/node-function) from [`${{ steps.package.outputs.old-version }}`](https://gcr.io/projectriff/node-function:${{ steps.package.outputs.old-version }}) to [`${{ steps.package.outputs.new-version }}`](https://gcr.io/projectriff/node-function:${{ steps.package.outputs.new-version }}).
branch: update/package/node-function
commit-message: |-
Bump gcr.io/projectriff/node-function from ${{ steps.package.outputs.old-version }} to ${{ steps.package.outputs.new-version }}
Bumps gcr.io/projectriff/node-function from ${{ steps.package.outputs.old-version }} to ${{ steps.package.outputs.new-version }}.
delete-branch: true
labels: semver:minor, type:dependency-upgrade
signoff: true
title: Bump gcr.io/projectriff/node-function from ${{ steps.package.outputs.old-version }} to ${{ steps.package.outputs.new-version }}
token: ${{ secrets.RIFF_GITHUB_TOKEN }}