Main #800
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: Main | |
on: | |
push: | |
schedule: | |
- cron: "0 0 * * *" | |
env: | |
DOCKER_CONTAINER_NAME: ivangabriele_tauri | |
DOCKERHUB_REPOSITORY: ivangabriele/tauri | |
DOCKERHUB_USERNAME: ivangabriele | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
OS: ["debian-bullseye", "debian-bookworm", "fedora-40"] | |
NODE_VERSION: ["20", "22"] | |
VARIANT: ["", "-nightly"] | |
env: | |
DOCKER_ARTIFACT_PATH: ./build/${{ matrix.OS }}-${{ matrix.NODE_VERSION }}${{ matrix.VARIANT }}.tar | |
DOCKER_IMAGE_TAG: ${{ matrix.OS }}-${{ matrix.NODE_VERSION }}${{ matrix.VARIANT }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build | |
run: | | |
docker build -f ./dockerfiles/${{ env.DOCKER_IMAGE_TAG }}.Dockerfile -t ${{ env.DOCKERHUB_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }} . | |
mkdir -p ./build | |
docker save -o ./build/${{ env.DOCKER_IMAGE_TAG }}.tar ${{ env.DOCKERHUB_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.DOCKER_IMAGE_TAG }} | |
path: ${{ env.DOCKER_ARTIFACT_PATH }} | |
retention-days: 1 | |
test: | |
name: Test | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
OS: ["debian-bullseye", "debian-bookworm", "fedora-40"] | |
NODE_VERSION: ["20", "22"] | |
VARIANT: ["", "-nightly"] | |
env: | |
DOCKER_ARTIFACT_PATH: ./build/${{ matrix.OS }}-${{ matrix.NODE_VERSION }}${{ matrix.VARIANT }}.tar | |
DOCKER_IMAGE_TAG: ${{ matrix.OS }}-${{ matrix.NODE_VERSION }}${{ matrix.VARIANT }} | |
NODE_VERSION: ${{ matrix.NODE_VERSION }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.DOCKER_IMAGE_TAG }} | |
path: ./build | |
- name: Start | |
run: | | |
docker load -i ${{ env.DOCKER_ARTIFACT_PATH }} | |
docker run -dt --name ${{ env.DOCKER_CONTAINER_NAME }} ${{ env.DOCKERHUB_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }} | |
- name: Run | |
run: npx -q jest | |
release: | |
name: Release | |
needs: test | |
if: ${{ github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
OS: ["debian-bullseye", "debian-bookworm", "fedora-40"] | |
NODE_VERSION: ["20", "22"] | |
VARIANT: ["", "-nightly"] | |
env: | |
DOCKER_ARTIFACT_PATH: ./build/${{ matrix.OS }}-${{ matrix.NODE_VERSION }}${{ matrix.VARIANT }}.tar | |
DOCKER_IMAGE_TAG: ${{ matrix.OS }}-${{ matrix.NODE_VERSION }}${{ matrix.VARIANT }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.DOCKER_IMAGE_TAG }} | |
path: ./build | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ env.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PAT }} | |
- name: Push to Docker Hub | |
run: | | |
docker load -i ${{ env.DOCKER_ARTIFACT_PATH }} | |
docker push ${{ env.DOCKERHUB_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }} | |
update_docker_hub_readme: | |
name: Update Docker Hub Readme | |
needs: release | |
if: ${{ github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update Docker Hub Readme | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ env.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PAT }} | |
repository: ${{ env.DOCKERHUB_REPOSITORY }} |