Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
jar-name: tp2intervals
jar-artifact-name: tp2intervals-jar

docker-image-new:
docker-image:
needs:
- jar
uses: ./.github/workflows/workflow-docker-image-new.yml
uses: ./.github/workflows/workflow-docker-image.yml
secrets: inherit
with:
jar-name: tp2intervals
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/new-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: New Release

on:
pull_request:
workflow_dispatch:

jobs:
jar:
uses: ./.github/workflows/workflow-jar.yml
secrets: inherit
with:

jar-name: tp2intervals
jar-artifact-name: tp2intervals-jar
dry-run: true

docker-image:
needs:
- jar
uses: ./.github/workflows/workflow-docker-image.yml
secrets: inherit
with:
jar-name: tp2intervals
jar-artifact-name: tp2intervals-jar
dry-run: false

electron:
needs:
- jar
strategy:
matrix:
environment:
- os: ubuntu-latest
- os: macos-latest
- os: windows-latest

uses: ./.github/workflows/workflow-electron.yml
secrets: inherit
with:
jar-name: tp2intervals
jar-artifact-name: tp2intervals-jar
os: ${{ matrix.environment.os }}
dry-run: true
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build PR

on:
pull_request:
# pull_request:
workflow_dispatch:

concurrency:
Expand All @@ -19,7 +19,7 @@ jobs:
docker-image:
needs:
- jar
uses: ./.github/workflows/workflow-docker-image-new.yml
uses: ./.github/workflows/workflow-docker-image.yml
with:
jar-name: tp2intervals
jar-artifact-name: tp2intervals-jar
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
jar-artifact-name: tp2intervals-jar
dry-run: false

docker-image-new:
docker-image:
needs:
- jar
uses: ./.github/workflows/workflow-docker-image-new.yml
uses: ./.github/workflows/workflow-docker-image.yml
secrets: inherit
with:
jar-name: tp2intervals
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: Docker Image

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
workflow_call:
inputs:
version:
required: false
type: string
default: 'dev'
jar-name:
required: true
type: string
Expand All @@ -20,21 +19,16 @@ on:
default: true

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
Expand All @@ -46,8 +40,6 @@ jobs:
name: ${{ inputs.jar-artifact-name }}
path: artifact

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: ${{ inputs.dry-run == false }}
uses: sigstore/cosign-installer@v3.8.1
Expand All @@ -57,14 +49,9 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 # v3.0.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: ${{ inputs.dry-run == false }}
uses: docker/login-action@v3 # v3.0.0
Expand All @@ -73,21 +60,16 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ inputs.version }}
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=tag
type=ref,event=branch
type=ref,event=pr

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6 # v5.0.0
Expand All @@ -101,17 +83,9 @@ jobs:
platforms: linux/amd64,linux/arm64
build-args: "JAR_PATH=artifact/${{ inputs.jar-name }}.jar"

# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ inputs.dry-run == false }}
env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
8 changes: 6 additions & 2 deletions .github/workflows/workflow-electron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Workflow Electron
on:
workflow_call:
inputs:
version:
required: false
type: string
default: 'dev'
jar-name:
required: true
type: string
Expand Down Expand Up @@ -40,13 +44,13 @@ jobs:

- name: Build electron
if: ${{ inputs.dry-run == true }}
run: npm run build --prefix electron
run: npm run build --prefix electron -- "-c.extraMetadata.version=${{ inputs.version }}"

- name: Publish electron
if: ${{ inputs.dry-run == false }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run publish --prefix electron
run: npm run publish --prefix electron -- -c.extraMetadata.version=${{ inputs.version }}

- name: Show me what you got
run: ls electron/dist
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/workflow-jar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Workflow JAR
on:
workflow_call:
inputs:
version:
required: false
type: string
default: 'dev'
jar-name:
required: true
type: string
Expand Down Expand Up @@ -50,7 +54,7 @@ jobs:
APP_DEFAULT_CONFIG_TRAINER_ROAD_REMOVE_HTML_TAGS: true
run: |
cd ./boot
./gradlew build
./gradlew build -Pversion=${{ inputs.version }}

- name: Cypress tests
run: |
Expand All @@ -61,7 +65,7 @@ jobs:
--app.default-config.training-peaks.auth-cookie=${{ secrets.TRAINING_PEAKS_AUTH_COOKIE }} \
& npm test --prefix cypress

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v6
with:
name: ${{ inputs.jar-artifact-name }}
path: boot/build/libs/${{ inputs.jar-name }}.jar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ data class WorkoutDetails(
other as WorkoutDetails

if (name != other.name) return false
if (duration != other.duration) return false
if (externalData != other.externalData) return false

return true
}

override fun hashCode(): Int {
var result = name.hashCode()
result = 31 * result + (duration?.hashCode() ?: 0)
result = 31 * result + externalData.hashCode()
return result
}
Expand Down
Loading