-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
37 lines (34 loc) · 1.37 KB
/
action.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
name: Goproxy GitHub Cache
description: Goproxy using GitHub Actions Cache
runs:
using: composite
steps:
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
# If not running a release version, build proxy
- uses: actions/setup-go@v4
with:
go-version: '^1.21.1'
cache: false
if: ${{ !startsWith(github.action_ref, 'v') }}
- run:
go build -o "${{ github.workspace }}/goproxy-github-cache" ./cmd/proxy
working-directory: ${{ github.action_path }}
shell: bash
if: ${{ !startsWith(github.action_ref, 'v') }}
# If running a release version, download build
- run: |
curl -sL https://github.com/jchadwick-buf/goproxy-github-cache/releases/download/$VERSION/proxy-${{runner.os}}-${{runner.arch}}${{runner.os == 'Windows' && '.exe' || ''}} -o goproxy-github-cache
chmod +x goproxy-github-cache
shell: bash
env:
VERSION: ${{github.action_ref}}
if: ${{ startsWith(github.action_ref, 'v') }}
- run: ./goproxy-github-cache &
shell: bash
- run: echo "GOPROXY=http://localhost:8123,direct" >> $GITHUB_ENV
shell: bash