Skip to content

CI/CD GitHub Action enhancements (test build / enhanced naming / updated actions) - #93

Open
swissbuechi wants to merge 2 commits into
JackMorrissey:masterfrom
swissbuechi:cicd-test-build
Open

CI/CD GitHub Action enhancements (test build / enhanced naming / updated actions)#93
swissbuechi wants to merge 2 commits into
JackMorrissey:masterfrom
swissbuechi:cicd-test-build

Conversation

@swissbuechi

Copy link
Copy Markdown

GitHub Action enhancements

The following changes were made to the main.yml GitHub Action:

Test builds

Run build on every commit, but deploy only when in master.

I removed branches: [ master ] to automatically run the action on every commit in every branch.
This way, you can always verify if the build of the project works.

You should also configure the action to need to pass on every PR as follows:

  • Navigate to: Settings / Branches / Master and select edit.
  • Scroll down and enable Require status checks to pass before merging
    • Select: Require branches to be up to date before merging
    • Select build-and-deployas a Status checks that are required
image

Additionally, on the deploy step, I added if: github.ref == 'refs/heads/master' to only trigger the FTP upload if we are in the master branch.

Updated actions

Actions like setup-node and checkout can usually be updated to the latest version without any problems.

I could also update the FTP-Deploy-Action from 3.1.1 to 3.1.2. Not sure about the 4.x.x versions, I've read they somehow do not support SFTP anymore and only use SCP now. Needs to be checked with the FTP Server. If we want to keep on using SFTP I would suggest a maintained action like https://github.com/wlixcc/SFTP-Deploy-Action/, worked fine for me in other projects.

Other small improvements

  • Small adjustments to the naming of the steps and the action.
  • Changes to files like README.md are ignored and do not trigger a run of the action, achieved by configuring them in paths-ignore:.
  • Added the required permissions: contents: read to limit the scope of the GH_TOKEN.
  • Added workflow_dispatch: to manually trigger the action if a redeploy to the FTP server is required for example.

Disclaimer

Sadly, I could not test all of these changes.
I'm happy to support you if anything goes wrong when merged.

swissbuechi added 2 commits February 5, 2025 10:04

@JackMorrissey JackMorrissey left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey thanks, I'll take a look at this when I have some more time. I just want to triple check that I'm not going to expose secrets in PR builds/forks. The FTP deploy has been broken for a while, so I'll likely take your suggestion and switch packages.

@swissbuechi

Copy link
Copy Markdown
Author

@JackMorrissey Sounds great. I'll create a PR with the new action if you wish.

@JackMorrissey

Copy link
Copy Markdown
Owner

Na no worries. I'll make some time to do it to deploy your update changes. It'll be easier to test with secrets and whatnot from my side. Thanks though!

@JackMorrissey

Copy link
Copy Markdown
Owner

This is next on my list. Just ran out of time. Thanks again for the huge contributions.

@swissbuechi

Copy link
Copy Markdown
Author

This is next on my list. Just ran out of time. Thanks again for the huge contributions.

I'll resolve the conflict tomorrow 👍🏼

Have you thought about hosting on GitHub pages? Seems like this stateless project would be a perfect fit tho. Just add a custom domain and call it a day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants