Skip to content

Commit a772fdf

Browse files
committed
Add upload to S3 action
1 parent c5e864e commit a772fdf

File tree

9 files changed

+3589
-3369
lines changed

9 files changed

+3589
-3369
lines changed

.github/workflows/deploy.yml

Lines changed: 55 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
os: [windows-2019, macos-10.15, ubuntu-18.04]
15+
os:
16+
- windows-2019
17+
- macos-10.15
18+
- ubuntu-18.04
1619
steps:
1720
- uses: actions/checkout@v2
1821

22+
- name: Install node
23+
uses: actions/setup-node@v2
24+
with:
25+
node-version: '12'
26+
1927
- name: Setup Python for Ubuntu
2028
run: |
2129
sudo apt-get install -y \
@@ -24,25 +32,20 @@ jobs:
2432
python3-distutils python3-setuptools python3-wheel python3-stdeb
2533
if: startsWith(matrix.os, 'ubuntu')
2634

27-
- name: Setup Python for not Ubuntu
28-
uses: actions/setup-python@v2
29-
with:
30-
python-version: 3.6
31-
if: startsWith(matrix.os, 'ubuntu') == false
32-
33-
- name: Install node
34-
uses: actions/setup-node@v2
35-
with:
36-
node-version: '12'
37-
38-
- name: Build binary for ubuntu
35+
- name: Build binary for Ubuntu
3936
run: |
4037
python3 -m venv env
4138
source env/bin/activate
4239
make build-quick
4340
if: startsWith(matrix.os, 'ubuntu')
4441

45-
- name: Build binary for not ubuntu
42+
- name: Setup Python for not Ubuntu
43+
uses: actions/setup-python@v2
44+
with:
45+
python-version: 3.6
46+
if: startsWith(matrix.os, 'ubuntu') == false
47+
48+
- name: Build binary for not Ubuntu
4649
run: make build-quick
4750
if: startsWith(matrix.os, 'ubuntu') == false
4851

@@ -52,6 +55,43 @@ jobs:
5255
path: |
5356
dist/*.pkg
5457
dist/*.exe
55-
dist/*.bash
58+
dist/install_linux.bash
5659
dist/*.deb
5760
if-no-files-found: error
61+
retention-days: 1
62+
63+
deploy:
64+
runs-on: ubuntu-latest
65+
needs: build
66+
67+
steps:
68+
- uses: actions/checkout@v2
69+
70+
- name: Configure AWS credentials
71+
uses: aws-actions/configure-aws-credentials@v1
72+
with:
73+
aws-access-key-id: ${{ secrets.AWS_S3_FS_ACCESS_KEY_ID }}
74+
aws-secret-access-key: ${{ secrets.AWS_S3_FS_SECRET_ACCESS_KEY }}
75+
aws-region: eu-west-1
76+
77+
- name: Download artifacts
78+
uses: actions/download-artifact@v2
79+
with:
80+
path: ./dist
81+
82+
- name: Set version
83+
run: |
84+
echo "VERSION=v$(jq --raw-output .version < package.json)" >> $GITHUB_ENV
85+
echo "S3_CP=aws s3 cp --acl public-read" >> $GITHUB_ENV
86+
echo "S3_SYNC=aws s3 sync --acl public-read" >> $GITHUB_ENV
87+
88+
- name: Upload fs to S3
89+
run: |
90+
$S3_CP dist/ubuntu*/install_linux.bash s3://codegradefs/$VERSION/install_linux.bash
91+
$S3_CP dist/ubuntu*/python3-fusepy*.deb s3://codegradefs/$VERSION/linux/python3-fusepy.deb
92+
$S3_CP dist/ubuntu*/python3-codegrade-fs*_all.deb s3://codegradefs/$VERSION/linux/python3-codegrade-fs_all.deb
93+
$S3_CP dist/ubuntu*/codegrade-fs*_amd64.deb s3://codegradefs/$VERSION/linux/codegrade-fs_amd64.deb
94+
$S3_CP dist/ubuntu*/codegrade-fs*_i386.deb s3://codegradefs/$VERSION/linux/codegrade-fs_i386.deb
95+
96+
$S3_CP dist/windows*/*.exe s3://codegradefs/$VERSION/codegrade_filesystem_installer.exe
97+
$S3_CP dist/mac*/*.pkg s3://codegradefs/$VERSION/codegrade_filesystem_installer.pkg

.scripts/make_install_linux_script.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
TEMPLATE = """
88
#!/bin/bash
9-
BASE_URL="https://codegradefs.s3-eu-west-1.amazonaws.com/v{{VERSION}}"
9+
BASE_URL="https://fs.codegrade.com/v{{VERSION}}/linux"
1010
1111
err_echo() {
1212
(>&2 echo "$@")
@@ -78,13 +78,9 @@
7878
trap '[[ -n $tmpdir ]] && rm -rf "$tmpdir"' 0 1 2 3 15
7979
8080
printf "\\\\nDownloading all needed files\\\\n"
81-
download_file "${BASE_URL}/linux/python3-fusepy_NEWEST-1_all.deb" "$tmpdir/fusepy.deb"
82-
if is_distro "Debian"; then
83-
download_file "${BASE_URL}/debian/python3-codegrade-fs_all.deb" "$tmpdir/backend.deb"
84-
else
85-
download_file "${BASE_URL}/ubuntu/python3-codegrade-fs_all.deb" "$tmpdir/backend.deb"
86-
fi
87-
download_file "${BASE_URL}/linux/codegrade-fs_$(get_arch).deb" "$tmpdir/frontend.deb"
81+
download_file "${BASE_URL}/python3-fusepy.deb" "$tmpdir/fusepy.deb"
82+
download_file "${BASE_URL}/python3-codegrade-fs_all.deb" "$tmpdir/backend.deb"
83+
download_file "${BASE_URL}/codegrade-fs_$(get_arch).deb" "$tmpdir/frontend.deb"
8884
8985
if _pip list | grep -- 'CodeGra.fs'; then
9086
printf "\\\\nRemoving old versions\\\\n"

codegra_fs/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
mountpoint_help = """Mountpoint for the file system. This should be an existing
1717
empty directory."""
1818

19-
password_help = """Your CodeGra.de password, don't pass this option if you want
19+
password_help = """Your CodeGrade password, don't pass this option if you want
2020
to pass your password over stdin. You can also use the `CGFS_PASSWORD`
2121
environment variable to pass your password."""
2222

codegra_fs/utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,13 @@ def get_fuse_install_message() -> t.Optional[t.Tuple[str, t.Optional[str]]]:
6363

6464

6565
def newer_version_available() -> bool:
66-
req = requests.get('https://codegra.de/.cgfs.version', timeout=2)
67-
return req.status_code < 300 and tuple(
68-
int(p) for p in req.content.decode('utf8').strip().split('.')
69-
) > codegra_fs.__version__
66+
try:
67+
req = requests.get('https://fs.codegrade.com/.cgfs.json', timeout=2)
68+
req.raise_for_status()
69+
latest = tuple(map(int, req.json()['version']))
70+
except:
71+
return False
72+
return latest > codegra_fs.__version__
7073

7174

7275
def find_all_dups(

docs/install.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ Installation
22
=============
33
The CodeGrade Filesystem is an external application that can be installed on
44
:fa:`windows` Windows, :fa:`apple` MacOS and :fa:`linux` Debian/Ubuntu. To install
5-
it go to `The CodeGrade website <https://codegra.de/filesystem/>`__ and follow
5+
it go to `The CodeGrade website
6+
<https://www.codegrade.com/download-codegrade-filesystem>`__ and follow
67
the instructions there.
78

89
Dependencies

0 commit comments

Comments
 (0)