Skip to content

Commit ec6c51c

Browse files
update GH Actions to default main branch
1 parent 085dc12 commit ec6c51c

File tree

3 files changed

+93
-95
lines changed

3 files changed

+93
-95
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
#
44
# You may wish to alter this file to override the set of languages analyzed,
55
# or to provide custom queries or build logic.
6-
name: "CodeQL"
6+
name: 'CodeQL'
77

88
on:
99
push:
10-
branches: [development, main, staging]
10+
branches: [main]
1111
pull_request:
1212
# The branches below must be a subset of the branches above
13-
branches: [development]
13+
branches: [main]
1414
schedule:
1515
- cron: '0 7 * * 6'
1616

@@ -29,43 +29,43 @@ jobs:
2929
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
3030

3131
steps:
32-
- name: Checkout repository
33-
uses: actions/checkout@v2
34-
with:
35-
# We must fetch at least the immediate parents so that if this is
36-
# a pull request then we can checkout the head.
37-
fetch-depth: 2
32+
- name: Checkout repository
33+
uses: actions/checkout@v2
34+
with:
35+
# We must fetch at least the immediate parents so that if this is
36+
# a pull request then we can checkout the head.
37+
fetch-depth: 2
3838

39-
# If this run was triggered by a pull request event, then checkout
40-
# the head of the pull request instead of the merge commit.
41-
- run: git checkout HEAD^2
42-
if: ${{ github.event_name == 'pull_request' }}
39+
# If this run was triggered by a pull request event, then checkout
40+
# the head of the pull request instead of the merge commit.
41+
- run: git checkout HEAD^2
42+
if: ${{ github.event_name == 'pull_request' }}
4343

44-
# Initializes the CodeQL tools for scanning.
45-
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v1
47-
with:
48-
languages: ${{ matrix.language }}
49-
# If you wish to specify custom queries, you can do so here or in a config file.
50-
# By default, queries listed here will override any specified in a config file.
51-
# Prefix the list here with "+" to use these queries and those in the config file.
52-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v1
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5353

54-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55-
# If this step fails, then you should remove it and run the build manually (see below)
56-
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v1
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
- name: Autobuild
57+
uses: github/codeql-action/autobuild@v1
5858

59-
# ℹ️ Command-line programs to run using the OS shell.
60-
# 📚 https://git.io/JvXDl
59+
# ℹ️ Command-line programs to run using the OS shell.
60+
# 📚 https://git.io/JvXDl
6161

62-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63-
# and modify them (or add more) to build your code if your project
64-
# uses a compiled language
62+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63+
# and modify them (or add more) to build your code if your project
64+
# uses a compiled language
6565

66-
#- run: |
67-
# make bootstrap
68-
# make release
66+
#- run: |
67+
# make bootstrap
68+
# make release
6969

70-
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v1
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v1

.github/workflows/header.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Header_Check
33
on:
44
pull_request:
55
branches:
6-
- development
6+
- main
77

88
jobs:
99
build:
@@ -13,22 +13,22 @@ jobs:
1313
- uses: actions/checkout@v2
1414
with:
1515
ref: ${{ github.head_ref }}
16-
16+
1717
- uses: actions/setup-python@v2
1818
with:
1919
python-version: '3.x'
2020
architecture: 'x64'
21-
21+
2222
- name: Check for and Add Headers
2323
run: |
2424
python ./.github/workflows/script.py
25-
25+
2626
- name: Git Diff
2727
id: git_diff
2828
run: |
2929
FILESCHANGED=$(git diff --quiet || echo "TRUE")
30-
echo "FILESCHANGED=$FILESCHANGED" >> $GITHUB_ENV
31-
30+
echo "FILESCHANGED=$FILESCHANGED" >> $GITHUB_ENV
31+
3232
- name: Commit and push files
3333
if: env.FILESCHANGED == 'TRUE'
3434
run: |
@@ -43,4 +43,3 @@ jobs:
4343
with:
4444
github_token: ${{ secrets.GITHUB_TOKEN }}
4545
branch: ${{ github.head_ref }}
46-

.github/workflows/main.yml

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ name: Build
33
on:
44
pull_request:
55
branches:
6-
- development
6+
- main
77
push:
8-
branches: [ development, staging ]
8+
branches: [main]
99
release:
10-
types: [ "published" ]
10+
types: ['published']
1111
workflow_dispatch:
1212
inputs:
1313
tagName:
@@ -18,56 +18,55 @@ jobs:
1818
build:
1919
runs-on: ubuntu-latest
2020
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
2123

22-
- name: Checkout
23-
uses: actions/checkout@v2
24+
- name: Prepare
25+
id: prep
26+
run: |
27+
DOCKER_IMAGE=cmusei/player-ui
28+
VERSION=development
29+
if [[ ! -z "${{ github.event.inputs.tagName }}" ]]; then
30+
VERSION=${{ github.event.inputs.tagName }}
31+
TAGS="${DOCKER_IMAGE}:${VERSION}"
32+
elif [[ $GITHUB_REF == refs/tags/* ]]; then
33+
VERSION=${GITHUB_REF#refs/tags/}
34+
MAJORMINORVERSION=$(echo $VERSION | grep -oP '(\d+)\.(\d+)')
35+
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${MAJORMINORVERSION}"
36+
elif [[ $GITHUB_REF == refs/heads/* ]]; then
37+
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
38+
TAGS="${DOCKER_IMAGE}:${VERSION}"
39+
fi
40+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
41+
echo ::set-output name=push::false
42+
echo "event is pull_request, not pushing image"
43+
else
44+
echo ::set-output name=push::true
45+
echo "event is not pull_request, pushing image"
46+
fi
47+
echo ::set-output name=version::${VERSION}
48+
echo ::set-output name=tags::${TAGS}
49+
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
2450
25-
- name: Prepare
26-
id: prep
27-
run: |
28-
DOCKER_IMAGE=cmusei/player-ui
29-
VERSION=development
30-
if [[ ! -z "${{ github.event.inputs.tagName }}" ]]; then
31-
VERSION=${{ github.event.inputs.tagName }}
32-
TAGS="${DOCKER_IMAGE}:${VERSION}"
33-
elif [[ $GITHUB_REF == refs/tags/* ]]; then
34-
VERSION=${GITHUB_REF#refs/tags/}
35-
MAJORMINORVERSION=$(echo $VERSION | grep -oP '(\d+)\.(\d+)')
36-
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${MAJORMINORVERSION}"
37-
elif [[ $GITHUB_REF == refs/heads/* ]]; then
38-
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
39-
TAGS="${DOCKER_IMAGE}:${VERSION}"
40-
fi
41-
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
42-
echo ::set-output name=push::false
43-
echo "event is pull_request, not pushing image"
44-
else
45-
echo ::set-output name=push::true
46-
echo "event is not pull_request, pushing image"
47-
fi
48-
echo ::set-output name=version::${VERSION}
49-
echo ::set-output name=tags::${TAGS}
50-
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
51+
- name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v1
5153

52-
- name: Set up Docker Buildx
53-
uses: docker/setup-buildx-action@v1
54+
- name: Login to DockerHub
55+
if: github.event_name != 'pull_request'
56+
uses: docker/login-action@v1
57+
with:
58+
username: ${{ secrets.DOCKERHUB_USERNAME }}
59+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
5460

55-
- name: Login to DockerHub
56-
if: github.event_name != 'pull_request'
57-
uses: docker/login-action@v1
58-
with:
59-
username: ${{ secrets.DOCKERHUB_USERNAME }}
60-
password: ${{ secrets.DOCKERHUB_PASSWORD }}
61-
62-
- name: Build and push
63-
uses: docker/build-push-action@v2
64-
with:
65-
context: .
66-
file: ./Dockerfile
67-
push: ${{ steps.prep.outputs.push }}
68-
pull: true
69-
tags: ${{ steps.prep.outputs.tags }}
70-
labels: |
71-
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
72-
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
73-
org.opencontainers.image.revision=${{ github.sha }}
61+
- name: Build and push
62+
uses: docker/build-push-action@v2
63+
with:
64+
context: .
65+
file: ./Dockerfile
66+
push: ${{ steps.prep.outputs.push }}
67+
pull: true
68+
tags: ${{ steps.prep.outputs.tags }}
69+
labels: |
70+
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
71+
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
72+
org.opencontainers.image.revision=${{ github.sha }}

0 commit comments

Comments
 (0)