Why is the release timestamp not changing when assets are updated? - github

I have an application that I develop and share via GitHub.
I automated the build of binaries via Actions
name: build stable version
on:
push:
branches:
- master
jobs:
release-linux-amd64:
name: release linux/amd64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- uses: wangyoucao577/go-release-action#v1.34
with:
github_token: ${{ secrets.REPO_TOKEN }}
goos: linux
goarch: amd64
compress_assets: OFF
overwrite: TRUE
release-windows-amd64:
name: release linux/amd64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- uses: wangyoucao577/go-release-action#v1.34
with:
github_token: ${{ secrets.REPO_TOKEN }}
goos: windows
goarch: amd64
compress_assets: OFF
overwrite: TRUE
I have two releases, stable version and development, which are updated with relevant binaries upon a push of the branch master or dev, respectively.
This works fine.
As you can see, the binaries were updated a few minutes ago, but the release timestamp points to two days ago, when I created that release:
Why isn't that timestamp updated with the updates of the binaries, and how to make it be synchronized with them?

I finally managed to have an Action that does the work
name: create release on tag
on:
push:
tags:
- "v*"
jobs:
build_release:
name: build_release
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout#v3
with:
fetch-depth: 0
- uses: actions/setup-go#v3
with:
go-version-file: "go.mod"
- name: build
run: go build -o sayhello .
- name: release
uses: softprops/action-gh-release#v1
with:
files: sayhello
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
The routine is to commit and push as usual, and when you decide to create a release you tag it (with a tag stating with v) and push the tag to GitHub.
This will trigger the action and create a release with the selected binaries. Source code will also be in the assets, I do not know how to make it so that they are not added (but this is a detail).

Related

Github actions token workflow not set error

Hello everyone I am currently writing a workflow to auto merge when a pull request is made but I am stuck at an error telling me my token is not set more specifically: 2023-02-19T02:09:08.581Z ERROR environment variable GITHUB_TOKEN not set!. I have set all my tokens in my repo and settings tab. Any help would be appreciated.
name: CI/CD
on:
pull_request:
branches: [ master ]
jobs:
super-linter:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout#v2
- name: Super-Linter
uses: github/super-linter#v4.10.1
with:
files: ${{ join(github.event.pull_request.changed_files, ',') }}
Merge:
runs-on: ubuntu-latest
needs: super-linter
steps:
- name: Checkout Code
uses: actions/checkout#v2
- name: Merge pull requests
uses: pascalgn/automerge-action#v0.14.1
with:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
deploy:
runs-on: self-hosted
needs: Merge
steps:
#- uses: actions/checkout#v2 #this is used for if you want to push all source code into runner
- name: update code base
working-directory: /test_pipe/www/html
run: sudo git pull origin master
- name: restart
working-directory: /test_pipe/www/html
run: sudo systemctl restart nginx
image of error
pascalgn/automerge-action accepts GITHUB_TOKEN as an env variable, not as an argument. So it should be:
- name: Merge pull requests
uses: pascalgn/automerge-action#v0.14.1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
Refer to the documentation: https://github.com/pascalgn/automerge-action#usage

Versions and Tags Not Being Created Properly on Github

I have modified the Github workflow on a practice app to make it change version and patch with every push to the master branch.
In Github workflows - it says this process has been successful:
However when I check under releases and tags - no releases or tags are listed.
Is there something I'm missing, here is my pipeline.yml
name: Deployment pipeline
on:
push:
branches:
- master
pull_request:
branches: [master]
types: [opened, synchronize]
jobs:
simple_deployment_pipeline:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout#v3
- uses: actions/setup-node#v3
with:
node-version: '16'
- name: npm install
run: npm install
- name: lint
run: npm run eslint
- name: build
run: npm run build
- name: test
run: npm run test
- name: e2e tests
uses: cypress-io/github-action#v4
with:
build: npm run
start: npm run start-prod
wait-on: http://localhost:5000
tag_release:
needs: [simple_deployment_pipeline]
runs-on: ubuntu-20.04
steps:
- name: Bump version and push tag
uses: anothrNick/github-tag-action#1.36.0
if: ${{ github.event_name == 'push' && !contains(join(github.event.commits.*.message, ' '), '#skip') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: patch
RELEASE_BRANCHES: master
The log under tag_release looks like this:
Your problem, which can be inferred by the error message, is that you haven't checked out the code inside the job. This is noted in the readme of the dependent action.
name: Bump version
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout#v3
with:
fetch-depth: '0'
- name: Bump version and push tag
uses: anothrNick/github-tag-action#v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
This is a common mistake, many assume that the code should exist in the job by default, but once you get varying type of workflows you will understand some use cases where you don't actually need to checkout the local git repo.
Take a look at the action you are using and consider sticking to the #v1 tag or at the very least pick a more recent version (1.36 is over a year old).

how to run GitHub Action after outage?

As you may (or may not) know yesterday was a major incident of GitHub's services: https://www.githubstatus.com/incidents/tyc8wpsgr2r8.
Unfortunately I published a release during that time and the action responsible for building and publishing the code didn't trigger.
For actions which were executed at least once I have an option to "Re-run workflow" - but how can I proceed with an action which didn't even trigger - I can not see it anywhere whatsoever?
I think the last resort would be to just make another release, remove the problematic one etc. but I'd like to avoid that.
The workflow file:
name: Node.js CI
on:
push:
branches: [master]
release:
types: [published]
pull_request:
branches: [master]
jobs:
test:
name: Test Node.js v${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 16
steps:
- uses: actions/checkout#v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install --production=false --no-package-lock
- name: Lint 💅🏻
run: npm run lint
- run: npm test
release:
name: Publish NPM Package
if: startsWith(github.ref, 'refs/tags/')
needs:
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- uses: actions/setup-node#v2
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- run: npm install --production=false --no-package-lock
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
gh-pages:
name: Publish GitHub Pages
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
needs:
- test
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout#v2
- uses: actions/setup-node#v2
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- name: Install ✔️
run: npm install --production=false --no-package-lock
- name: Build storybook 🏗️
run: npm run build-storybook
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action#4.1.3
with:
branch: gh-pages
folder: storybook-static
As you said in the comment, the easiest solution would be to remove the release and create it all over again.
Another option could be to add a workflow_dispatch event trigger to the workflow with a tag input, updating the jobs condition to use this input.tag variable if informed.
That way, if an automatic trigger failed (through push, release or pull_request), you could trigger it manually through the Github UI or the GH CLI as an alternative.

github action runner showing "idle" and not updating the main website

I have been using DigitalOcean: if I change or commit repository the website not being updated.
I am using just one master branch, I had 23 file changes but on the site no effects.
here is my action code:
name: Node.js CI
on:
push:
branches: [ master ]
jobs:
build:
runs-on: self-hosted
strategy:
matrix:
node-version: [14.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout#v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm i
- run: npm run build --if-present
- run: npm test
if I change or commit repository the website not being updated.
I am using just one master branch,
First, a change or commits are local actions: you need to push (git push) to GitHub in order for any action to have a chance to run.
Second, assuming that you have pushed, but your workflow was not triggered, add a on: directive (that you have) and double-check your default branch: recent repositories are using main, not master.
You can see an example in the official GitHub documentation "Building and testing Node.js / Starting with the Node.js workflow template":
name: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 15.x]
steps:
- uses: actions/checkout#v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
Third, if you need to see some effect on a DigitalOcean Droplet, you might need to use digitalocean/action-doctl, in order to deploy (to DigitalOcean) what your GitHub action has build on GitHub side.

A workflow is not triggering a second workflow

The workflow in file inrisk.packages.ci.yml generates a tag and a realise of the code when a push is done in the develop branch. The below works as expected.
name: Code Int
on:
push:
paths:
- 'infra/**'
jobs:
ci:
runs-on: ubuntu-latest
steps:
# Checks-out to $GITHUB_WORKSPACE
- uses: actions/checkout#v2
- name: Basic Checks
run: |
whoami
ls -lah
pwd
- uses: actions/setup-node#v1
# Create a new release when on develop which triggers the deployment
- name: Bump version and push tag
if: github.ref == 'refs/heads/develop'
uses: mathieudutour/github-tag-action#v4.5
id: tag_version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
if: github.ref == 'refs/heads/develop'
id: create_release
uses: actions/create-release#v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
draft: false
prerelease: false
The below workflow in file inrisk.packages.cd.yml and is suppose to be triggered when ever a tag/realise is created/published.
name: Code Deploy
on:
push:
tags:
- 'v*'
release:
types:
- published
- created
- released
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# Checks-out to $GITHUB_WORKSPACE
- uses: actions/checkout#v2
- uses: actions/setup-node#v1
- name: Install Yarn
run: npm install -g yarn
- uses: chrislennon/action-aws-cli#v1.1
- name: Install, Build and Deploy
run: |
whoami
ls -lah
pwd
The second workflow Code Deploy dose not get trigger after Code Int publishes/created a tag/realise
However when I manually create a realise/tag the second workflow Code Deploy get triggered
This seems to be by design as stated here .This is to stop recursive workflow runs.
I used this article to get around the problem