nightly #1069
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: nightly | |
on: | |
schedule: | |
- cron: '2 2 * * *' | |
jobs: | |
create-tag: | |
name: Create tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
set-safe-directory: true | |
- name: Set tag name | |
id: git_tag | |
run: echo "::set-output name=tag::$(git describe --tags --match '[0-9].[0-9].[0-9]')" | |
- name: check if tag exists | |
id: tag_exists | |
run: | | |
set -x | |
exists=false | |
[ "$(git tag -l "${TAG}")" = "${TAG}" ] && exists=true | |
[ "$(git tag -l "nightly-${TAG}")" = "nightly-${TAG}" ] && exists=true | |
echo "::set-output name=result::${exists}" | |
env: | |
TAG: ${{ steps.git_tag.outputs.tag }} | |
- name: Setup SSH Keys and known_hosts | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: | | |
mkdir -p ~/.ssh | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
ssh-add - <<< "${{ secrets.GH_SSH_KEY }}" | |
if: ${{ steps.tag_exists.outputs.result != 'true' }} | |
- name: Create tag | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
TAG: "nightly-${{ steps.git_tag.outputs.tag }}" | |
run: | | |
git tag "${TAG}" | |
git remote set-url origin [email protected]:doitintl/kube-no-trouble.git | |
git push origin "refs/tags/${TAG}" | |
if: ${{ steps.tag_exists.outputs.result != 'true' }} |