chore: #release #179
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: release | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build-pkg: | |
if: "contains(github.event.head_commit.message, '#release')" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PA_TOKEN }} | |
submodules: true | |
# Setup .npmrc file to publish to GitHub Packages | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://npm.pkg.github.com' | |
# Defaults to the user or organization that owns the workflow file | |
scope: '@gurbaninow' | |
- run: npm ci | |
- name: Build database | |
run: npm run build-sqlite | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-mariadb: | |
if: "contains(github.event.head_commit.message, '#release')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PA_TOKEN }} | |
submodules: true | |
- name: Docker login | |
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.actor }} --password-stdin | |
- uses: benjlevesque/[email protected] | |
id: short-sha | |
- name: Set build tag | |
run: echo "DOCKER_IMAGE_TAG=${{ steps.short-sha.outputs.sha }}-$(date +%s)" >> $GITHUB_ENV | |
- name: Build container | |
run: docker build -f docker/mariadb/Dockerfile -t ghcr.io/gurbaninow/database:${{ env.DOCKER_IMAGE_TAG }} . | |
- name: Publish container | |
run: | | |
docker push ghcr.io/gurbaninow/database:${{ env.DOCKER_IMAGE_TAG }} | |
docker tag ghcr.io/gurbaninow/database:${{ env.DOCKER_IMAGE_TAG }} ghcr.io/gurbaninow/database:latest | |
docker tag ghcr.io/gurbaninow/database:${{ env.DOCKER_IMAGE_TAG }} ghcr.io/gurbaninow/database:dev | |
docker push ghcr.io/gurbaninow/database:latest | |
docker push ghcr.io/gurbaninow/database:dev | |
backport: | |
if: "contains(github.event.head_commit.message, '#release')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PA_TOKEN }} | |
submodules: true | |
- uses: actions/setup-node@v3 | |
- run: npm ci | |
- name: Backport data | |
run: npm run backport | |
- name: Checkout shabados/database:main | |
run: git clone --depth 1 --branch 4.8.7 https://github.com/shabados/database.git ../shabados | |
- name: Copy backported data | |
run: rm -rf ../shabados/data && cp -r data ../shabados/ | |
- name: Docker login | |
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.actor }} --password-stdin | |
- uses: benjlevesque/[email protected] | |
id: short-sha | |
- name: Set build tag | |
run: echo "DOCKER_IMAGE_TAG=4-${{ steps.short-sha.outputs.sha }}-$(date +%s)" >> $GITHUB_ENV | |
- name: Build container | |
working-directory: ../shabados | |
run: docker build -f docker/mariadb/Dockerfile -t ghcr.io/gurbaninow/database:${{ env.DOCKER_IMAGE_TAG }} . | |
- name: Publish container | |
working-directory: ../shabados | |
run: docker push ghcr.io/gurbaninow/database:${{ env.DOCKER_IMAGE_TAG }} |