Skip to content

Commit

Permalink
Merge pull request #3 from pixelfusion/feat/ci-release
Browse files Browse the repository at this point in the history
fix: implement github actions automated deployment on merge
  • Loading branch information
tractorcow authored Nov 19, 2024
2 parents 4ec2964 + 66fbfd4 commit 94c44ae
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure git user
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Tag semantic release
id: tag
uses: pixelfusion/actions/tag@v1

- name: Run release
shell: bash
run: make release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
[
"@semantic-release/exec",
{
"successCmd": "echo '${nextRelease.gitTag}' > version.txt"
"successCmd": "echo '${nextRelease.gitTag}' > version.txt",
"prepareCmd": "./package-release.sh ${nextRelease.version}"
}
]
]
Expand Down
23 changes: 23 additions & 0 deletions package-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Check if a version parameter is provided
if [ $# -eq 0 ]; then
echo "Error: Version parameter is missing."
exit 1
fi

# Store the version parameter
version=$1

# Update package.json with the provided version
jq --arg version "$version" '.version = $version' gatsby-plugin-s3/package.json > gatsby-plugin-s3/package-temp.json
mv gatsby-plugin-s3/package-temp.json gatsby-plugin-s3/package.json

# Commit the package.json changes
git add gatsby-plugin-s3/package.json
git commit -m "chore: update package.json version to $version"

# Push the changes to origin
git push origin

echo "Package version updated successfully to $version and changes pushed to origin."

0 comments on commit 94c44ae

Please sign in to comment.