Skip to content

Commit 27205e9

Browse files
committed
Gitlab to use proxy instead of copy
1 parent 1953ff7 commit 27205e9

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

Diff for: .github/workflows/release.yaml

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy to Workers Prod
1+
name: build
22

33
on:
44
push:
@@ -25,6 +25,9 @@ jobs:
2525
- name: Build Github Index
2626
run: ./build-github.sh
2727

28+
- name: Build Gitlab Index
29+
run: ./build-gitlab.sh
30+
2831
- run: echo "::set-env name=RELEASE_DATE::$(date -u +%Y-%m-%dT%H:%M:%SZ)"
2932
- run: echo "::set-env name=RELEASE_TAG::$(date -u +%Y%m%d-%H%M%S)"
3033
- run: echo "Release date is ${{ env.RELEASE_DATE }}"
@@ -42,8 +45,8 @@ jobs:
4245
draft: false
4346
prerelease: false
4447

45-
- name: Upload .tgz
46-
id: upload
48+
- name: Upload Github .tgz
49+
id: upload_github
4750
uses: actions/[email protected]
4851
env:
4952
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -52,3 +55,14 @@ jobs:
5255
asset_path: ./build/sourceData-github.tgz
5356
asset_name: sourceData-github.tgz
5457
asset_content_type: application/gzip
58+
59+
- name: Upload Gitlab .tgz
60+
id: upload_gitlab
61+
uses: actions/[email protected]
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
with:
65+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
66+
asset_path: ./build/sourceData-gitlab.tgz
67+
asset_name: sourceData-gitlab.tgz
68+
asset_content_type: application/gzip

Diff for: bin/loadrepo.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,23 @@
8282
if repodata['provider'] == 'github':
8383
giturl = "https://github.com/" + repodata['repo']
8484
elif repodata['provider'] == 'gitlab':
85-
giturl = "https://gitlab.com/" + repodata['repo']
85+
giturl = "https://gitlab.com/" + repodata['repo'] + ".git/"
8686
else:
8787
sys.stderr.write("ERROR: unknown or missing provider '%s'\n" % repodata['provider'])
8888
sys.exit(3)
8989

9090
if os.path.isdir(gitdir):
9191
os.chdir(gitdir)
9292

93-
cached_commit = sh.git("rev-parse", "HEAD", "--", _err_to_out=True, _out=sys.stdout)
93+
cached_commit = sh.git("rev-parse", "HEAD", "--", _err_to_out=True)
9494

9595
if args.verbose:
9696
sys.stdout.write("INFO: pulling changes from git repo %s\n" % giturl)
9797
sh.git.pull("origin", repodata["branch"], _err_to_out=True, _out=sys.stdout)
9898
if args.verbose:
9999
sys.stdout.write("INFO: pull complete\n")
100100

101-
current_commit = sh.git("rev-parse", "HEAD", _err_to_out=True, _out=sys.stdout)
101+
current_commit = sh.git("rev-parse", "HEAD", _err_to_out=True)
102102
if cached_commit == current_commit:
103103
if args.always:
104104
sys.stdout.write("INFO: no changes to repo since last run but processing anyway\n")
@@ -136,8 +136,8 @@
136136
sys.stdout.write("INFO: switching to branch '%s'\n" % (repodata['branch']))
137137
sh.git.checkout(repodata['branch'], _err_to_out=True, _out=sys.stdout)
138138

139-
current_commit = sh.git("rev-parse", "HEAD", _err_to_out=True, _out=sys.stdout)
140-
last_mod = "%s" % sh.git.log("-1", "--format=%cd", "--date=iso", _tty_out=False)
139+
current_commit = sh.git("rev-parse", "HEAD", _err_to_out=True)
140+
last_mod = ("%s" % sh.git.log("-1", "--format=%cd", "--date=iso", _tty_out=False)).strip()
141141
sys.stdout.write("INFO: last modified on %s\n" % last_mod)
142142

143143
logodir = os.path.join(gitdir, repodata['directory'])
@@ -208,9 +208,10 @@
208208
sys.stdout.write("DEBUG: repo %s copy from '%s' to '%s' (%s)\n" % (repo_handle, str(srcpath), dstpath, shortpath))
209209

210210
imgurl = args.cdnprefix + shortpath
211-
else:
211+
elif args.provider == 'github':
212212
imgurl = "https://raw.githubusercontent.com/" + repodata["repo"] + "/" + repodata["branch"] + srcpath[len(gitdir):]
213-
213+
elif args.provider == 'gitlab':
214+
imgurl = "https://gitlab.svg.zone/" + repodata["repo"] + "/raw/" + repodata["branch"] + srcpath[len(gitdir):]
214215

215216
images.append({
216217
'name': name,

Diff for: build-gitlab.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ OUTPUT_DIR=${LOCAL_DIR:-./remote}
2525
#
2626
echo "INFO: loading logos into ${OUTPUT_DIR}"
2727
./bin/loadrepo.py \
28-
--cdnprefix=${CDN_PREFIX} \
28+
--nocopy \
2929
--output=${OUTPUT_DIR} \
3030
--provider=gitlab
3131

0 commit comments

Comments
 (0)