minor tweaks ✅; 4.10.2 #52
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build & upload binaries | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
test: | |
name: run tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: | |
- '16.x' | |
- '18.x' | |
- '20.x' | |
- '22.x' | |
postgis-docker-tag: | |
- '14-3.4-alpine' | |
- '15-3.4-alpine' | |
- '16-3.4-alpine' | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: install sponge (moreutils) | |
run: sudo apt install -y moreutils | |
- name: install & start PostgreSQL with PostGIS | |
# todo: currently, it uses mdillon, which doesn't have PostgreSQL 14 | |
# uses: huaxk/postgis-action@v1 | |
# with: | |
# postgresql version: '${{ matrix.postgis-docker-tag }}' | |
# postgresql password: password | |
# postgresql user: postgres | |
# postgresql db: postgres | |
run: | | |
docker run -d \ | |
-e POSTGRES_USER=$PGUSER -e POSTGRES_PASSWORD=$PGPASSWORD -e POSTGRES_DB=$PGDATABASE \ | |
-p 5432:5432 postgis/postgis:${{ matrix.postgis-docker-tag }} \ | |
-c timezone=Europe/Berlin | |
env: | |
PGUSER: postgres | |
PGPASSWORD: password | |
PGDATABASE: postgres | |
- run: npm install | |
- run: npm run lint | |
- name: npm test | |
run : npm test | |
env: | |
PGHOST: localhost | |
PGPORT: '5432' | |
PGUSER: postgres | |
PGPASSWORD: password | |
PGDATABASE: postgres | |
binaries: | |
name: build binaries & publish as GitHub release | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- run: npm install | |
- name: build binaries | |
run: npm run build-binaries | |
- name: compress binaries | |
run: | | |
set -e | |
gzip --best -k dist/* | |
ls -lh dist | |
- name: create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: gtfs-via-postgres@${{ github.ref }} | |
- name: upload x64 macOS binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./dist/gtfs-via-postgres-macos-x64 | |
asset_name: gtfs-via-postgres-macos-x64 | |
asset_content_type: application/octet-stream | |
- name: upload compressed x64 macOS binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./dist/gtfs-via-postgres-macos-x64.gz | |
asset_name: gtfs-via-postgres-macos-x64.gz | |
asset_content_type: application/octet-stream | |
- name: upload arm64 macOS binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./dist/gtfs-via-postgres-macos-arm64 | |
asset_name: gtfs-via-postgres-macos-arm64 | |
asset_content_type: application/octet-stream | |
- name: upload compressed arm64 macOS binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./dist/gtfs-via-postgres-macos-arm64.gz | |
asset_name: gtfs-via-postgres-macos-arm64.gz | |
asset_content_type: application/octet-stream | |
- name: upload x64 Linux binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./dist/gtfs-via-postgres-linux-x64 | |
asset_name: gtfs-via-postgres-linux-x64 | |
asset_content_type: application/octet-stream | |
- name: upload compressed x64 Linux binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./dist/gtfs-via-postgres-linux-x64.gz | |
asset_name: gtfs-via-postgres-linux-x64.gz | |
asset_content_type: application/octet-stream | |
- name: upload arm64 Linux binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./dist/gtfs-via-postgres-linux-arm64 | |
asset_name: gtfs-via-postgres-linux-arm64 | |
asset_content_type: application/octet-stream | |
- name: upload compressed arm64 Linux binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./dist/gtfs-via-postgres-linux-arm64.gz | |
asset_name: gtfs-via-postgres-linux-arm64.gz | |
asset_content_type: application/octet-stream | |
docker-image: | |
name: build & publish Docker image | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: use Docker buildx | |
uses: docker/setup-buildx-action@v4 | |
- name: build Docker image & push to Docker Hub | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: | | |
ghcr.io/public-transport/gtfs-via-postgres:latest | |
ghcr.io/public-transport/gtfs-via-postgres:4 | |
# https://github.com/docker/build-push-action/blob/9472e9021074a3cb3279ba431598b8836d40433f/docs/advanced/cache.md#github-cache | |
# https://github.com/moby/buildkit#registry-push-image-and-cache-separately | |
cache-from: type=gha | |
cache-to: type=gha,mode=max,oci-mediatypes=true,compression=zstd |