Files

119 lines
3.1 KiB
YAML

name: Release
on:
release:
types:
- published
jobs:
sde:
name: Fetch SDE
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Python2
run: |
choco install python2
C:\Python27\python.exe -m pip install --upgrade pip
C:\Python27\python.exe -m pip install requests
- name: Download loaders
run: |
C:\Python27\python.exe download_sde/download_loaders.py ${{ github.ref_name }}
- name: Execute loaders
run: |
C:\Python27\python.exe download_sde/execute_loaders.py
- name: Publish artifact
uses: actions/upload-artifact@v4
with:
name: sde
path: json
datafiles:
name: Publish datafiles
runs-on: ubuntu-latest
needs: [sde]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install NodeJS
uses: actions/setup-node@v4
with:
registry-url: https://npm.pkg.github.com
scope: "@eveshipfit"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set version
run: |
# Remove the "v" from the version.
VERSION=$(echo ${{ github.ref_name }} | cut -b2-)
echo "Version: ${VERSION}"
sed -i 's/"version": "0.0.0-git"/"version": "'${VERSION}'"/' package.json
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y --no-install-recommends rclone protobuf-compiler
pip install -r requirements.txt
npm install
- name: Setup rclone
run: |
mkdir -p ~/.config/rclone
echo "[eveshipfit]" > ~/.config/rclone/rclone.conf
echo "type = s3" >> ~/.config/rclone/rclone.conf
echo "provider = Cloudflare" >> ~/.config/rclone/rclone.conf
echo "acl = private" >> ~/.config/rclone/rclone.conf
echo "no_check_bucket = true" >> ~/.config/rclone/rclone.conf
- name: Add mimetype for pb2
run: |
echo "application/x-protobuf pb2" | sudo tee -a /etc/mime.types
echo "80:application/x-protobuf:*.pb2" | sudo tee -a /usr/share/mime/globs2
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: sde
path: sde
- name: Convert SDE YAML to Protobuf
run: |
protoc --python_out=. esf.proto
python -m convert sde
cp esf.proto dist/
- name: Fetch icons
run: |
python -m download_icons sde
- name: Build package
run: |
npm run build
- name: Publish package
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
registry: "https://npm.pkg.github.com"
package: package.json
- name: Publish to R2 bucket
run: |
rclone copy dist eveshipfit:eveshipfit/${{ github.event.release.tag_name }}/ --progress --include=*.{pb2,png}
env:
RCLONE_CONFIG_EVESHIPFIT_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
RCLONE_CONFIG_EVESHIPFIT_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
RCLONE_CONFIG_EVESHIPFIT_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}