Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve GitHub actions workflows #212

Merged
merged 41 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b97eb27
Removed unused steps
DaveKeehl Apr 7, 2024
5219af9
Updated steps and worflows titles
DaveKeehl Apr 7, 2024
1d3e882
Adding job
DaveKeehl Apr 7, 2024
223ed5a
Failing job if no different version if detected
DaveKeehl Apr 7, 2024
744b8f9
Fixed typos
DaveKeehl Apr 7, 2024
c024bfd
Trying out new workflow logic
DaveKeehl Apr 7, 2024
7d16347
Verifying logic correctness
DaveKeehl Apr 7, 2024
00abd57
Changed operator
DaveKeehl Apr 7, 2024
8f7e61e
Debugging
DaveKeehl Apr 7, 2024
c21f3f6
Debugging
DaveKeehl Apr 7, 2024
2661b58
Debugging
DaveKeehl Apr 7, 2024
0e236d0
Debugging
DaveKeehl Apr 7, 2024
b07ebaf
Improved error message
DaveKeehl Apr 7, 2024
8a4a57e
Updated release workflow
DaveKeehl Apr 7, 2024
3072667
Modified ci workflow trigger events
DaveKeehl Apr 7, 2024
dd6f9e5
Removed dummy workflow
DaveKeehl Apr 7, 2024
d6317fa
Checking out workflow dispatch
DaveKeehl Apr 7, 2024
a21a97e
Updated workflows
DaveKeehl Apr 7, 2024
32c1ed1
Renamed step
DaveKeehl Apr 7, 2024
dc84f65
Testing out new semver check
DaveKeehl Apr 7, 2024
c8ab22f
Debugging
DaveKeehl Apr 7, 2024
c48e47e
Debugging
DaveKeehl Apr 7, 2024
a86698d
Debugging
DaveKeehl Apr 7, 2024
a106e64
Debugging
DaveKeehl Apr 7, 2024
7c7d6d0
Debugging
DaveKeehl Apr 7, 2024
1c09338
Debugging
DaveKeehl Apr 7, 2024
500ccf1
Debugging
DaveKeehl Apr 7, 2024
6213ffc
Debugging
DaveKeehl Apr 7, 2024
e9849a2
Debugging
DaveKeehl Apr 7, 2024
53775cf
Debugging
DaveKeehl Apr 7, 2024
9bc93da
Debugging
DaveKeehl Apr 7, 2024
6e767b3
Debugging
DaveKeehl Apr 7, 2024
d1e8484
Debugging
DaveKeehl Apr 7, 2024
6cfa2bd
Debugging
DaveKeehl Apr 7, 2024
82357a8
Debugging
DaveKeehl Apr 7, 2024
0687ebf
Updated release workflow
DaveKeehl Apr 7, 2024
15b9af6
Updated dummy workflow
DaveKeehl Apr 7, 2024
6efb162
Upgraded action
DaveKeehl Apr 7, 2024
b326a0a
Upgraded actions
DaveKeehl Apr 7, 2024
b5b907a
Upgraded actions
DaveKeehl Apr 7, 2024
3655030
Removed dummy workflow
DaveKeehl Apr 7, 2024
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
17 changes: 3 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: CI

on: [push, pull_request]
on: [push]

jobs:
CI:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -17,19 +17,8 @@ jobs:
node-version: 20
cache: 'npm'

- name: Installing dependencies
- name: Install dependencies
run: npm ci

- name: Build package
run: npm run build -- --filter=svelte-reveal

# - name: Testing
# run: npm run test

# - name: SonarCloud Scan
# uses: sonarsource/sonarcloud-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# with:
# projectBaseDir: packages/svelte-reveal
56 changes: 43 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,52 @@
name: 'Publish to NPM'
name: Release

on:
pull_request:
types:
- opened
- synchronize
- closed
branches:
- main

jobs:
check-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.package-version.outputs.current-version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get current version
id: package-version
uses: martinbeentjes/[email protected]
with:
path: 'packages/svelte-reveal'

- name: Get latest tag
id: latest-tag
uses: 'WyriHaximus/github-action-get-previous-tag@v1'

- name: Compare versions
uses: madhead/semver-utils@v4
id: version
with:
version: ${{ steps.latest-tag.outputs.tag }}

- name: Detected invalid semver upgrade
if: ${{ steps.package-version.outputs.current-version != steps.version.outputs.inc-major && steps.package-version.outputs.current-version != steps.version.outputs.inc-minor && steps.package-version.outputs.current-version != steps.version.outputs.inc-patch }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('Invalid semver upgrade (${{ steps.latest-tag.outputs.tag }} -> ${{ steps.package-version.outputs.current-version }})')

release:
if: github.event.pull_request.merged == true && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: check-version
if: github.event.pull_request.merged == true
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -23,7 +59,7 @@ jobs:
node-version: 20
cache: 'npm'

- name: Installing dependencies
- name: Install dependencies
run: npm ci

- name: Build package
Expand All @@ -40,12 +76,6 @@ jobs:
package: ./packages/svelte-reveal/package.json
strategy: upgrade

- name: Get Package Version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
with:
path: 'packages/svelte-reveal'

- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
Expand All @@ -58,8 +88,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.package-version.outputs.current-version }}
release_name: ${{ steps.package-version.outputs.current-version }}
tag_name: ${{ needs.check-version.outputs.version }}
release_name: ${{ needs.check-version.outputs.version }}
draft: false
prerelease: false
body: ${{ steps.extract-release-notes.outputs.release_notes }}
Expand All @@ -71,6 +101,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./packages/svelte-reveal/svelte-reveal-${{ steps.package-version.outputs.current-version }}.tgz
asset_name: svelte-reveal-${{ steps.package-version.outputs.current-version }}.tgz
asset_path: ./packages/svelte-reveal/svelte-reveal-${{ needs.check-version.outputs.version }}.tgz
asset_name: svelte-reveal-${{ needs.check-version.outputs.version }}.tgz
asset_content_type: application/gzip