Skip to content

Commit

Permalink
feat: build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 12, 2022
0 parents commit 900cf46
Show file tree
Hide file tree
Showing 34 changed files with 15,839 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
ARG VARIANT=16-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"

# [Optional] Uncomment if you want to install more global node packages
# RUN su node -c "npm install -g <your-package-list -here>"
17 changes: 17 additions & 0 deletions .devcontainer/base.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
ARG VARIANT=16-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

# Install tslint, typescript. eslint is installed by javascript image
ARG NODE_MODULES="tslint-to-eslint-config typescript"
COPY library-scripts/meta.env /usr/local/etc/vscode-dev-containers
RUN su node -c "umask 0002 && npm install -g ${NODE_MODULES}" \
&& npm cache clean --force > /dev/null 2>&1

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
45 changes: 45 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/typescript-node
{
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 18, 16, 14.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"args": {
"VARIANT": "18-bullseye"
}
},

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"yzhang.markdown-all-in-one",
"ms-vscode.makefile-tools",
"christian-kohler.npm-intellisense",
"esbenp.prettier-vscode"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

"onCreateCommand": "npm install; brew install act",
"updateContentCommand": "npm install",
"postStartCommand": "sudo apt update && sudo apt full-upgrade -y",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node",
"features": {
"docker-in-docker": "latest",
"git": "latest",
"github-cli": "latest",
"homebrew": "latest"
}
}
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.git
.github
.gitignore
.idea
.vscode
.devcontainer
.prettierrc.json
CHANGELOG.md
fake_collection
node_modules
coverage
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: artis3n
53 changes: 53 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: 2
updates:
- package-ecosystem: npm
directory: '/'
schedule:
interval: monthly
reviewers:
- artis3n
assignees:
- artis3n
commit-message:
prefix: fix
prefix-development: chore
include: scope

- package-ecosystem: github-actions
directory: '/'
schedule:
interval: monthly
reviewers:
- artis3n
assignees:
- artis3n
commit-message:
prefix: fix
prefix-development: chore
include: scope

- package-ecosystem: docker
directory: '/'
schedule:
interval: monthly
reviewers:
- artis3n
assignees:
- artis3n
commit-message:
prefix: fix
prefix-development: chore
include: scope

- package-ecosystem: pip
directory: '/'
schedule:
interval: monthly
reviewers:
- artis3n
assignees:
- artis3n
commit-message:
prefix: fix
prefix-development: chore
include: scope
118 changes: 118 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Testing the Action

on: [pull_request]

env:
RUNNER_TEMP: /tmp
TEST_ARTIFACT_VERSION: 0.8.9

jobs:
local_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.0.2

- uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: 'npm'
check-latest: true

- name: Install Dependencies
run: npm ci

- name: Check Format
run: npm run format-check

- name: Run tests
run: npm test

test_deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3.0.2

- name: Set up action.yml
run: cp action_ci.yml action.yml

- name: Test the action
uses: ./
with:
api_key: '${{ secrets.GALAXY_API_KEY }}'
# Fake location that's a small amount of content
collection_dir: 'fake_collection'

- name: Test the action with a custom version
uses: ./
with:
api_key: '${{ secrets.GALAXY_API_KEY }}'
collection_dir: 'fake_collection'
# Custom version
galaxy_version: '${{ env.TEST_ARTIFACT_VERSION }}-test'

test_build_then_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.0.2

- name: Set up action.yml
run: cp action_ci.yml action.yml

- name: Test the action - only build
uses: ./
with:
api_key: '${{ secrets.GALAXY_API_KEY }}'
collection_dir: 'fake_collection'
# Different from above version
galaxy_version: '${{ env.TEST_ARTIFACT_VERSION }}-build'
build: true
publish: false

- name: Test the action - only publish
uses: ./
with:
api_key: '${{ secrets.GALAXY_API_KEY }}'
collection_dir: 'fake_collection'
# Should match version above
galaxy_version: '${{ env.TEST_ARTIFACT_VERSION }}-build'
build: false
publish: true

snapshot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.0.2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.0.0
with:
install: true

- name: Login to GitHub Container Registry
uses: docker/login-action@v2.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4.0.1
with:
images: |
ghcr.io/artis3n/ansible_galaxy_collection-testartifact
tags: |
type=raw,value=SNAPSHOT-${{ github.sha }}
- name: Build and Push
uses: docker/build-push-action@v3.1.1
with:
context: .
platforms: linux/amd64
file: ./Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
on:
release:
types:
- published

env:
IMAGE_NAME: artis3n/ansible_galaxy_collection

name: Release
jobs:
release:
name: Release GitHub Actions
runs-on: ubuntu-latest
steps:
- name: Semver release
uses: technote-space/release-github-actions@v7.2.4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CLEAN_TARGETS: ''

deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3.0.2

- name: Get the version
run: echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

- name: Set up QEMU
uses: docker/setup-qemu-action@v2.0.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.0.0
with:
install: true

- name: Docker meta
id: meta
uses: docker/metadata-action@v4.0.1
with:
images: |
ghcr.io/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=raw,value=${{ env.RELEASE_VERSION }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push
uses: docker/build-push-action@v3.1.1
with:
context: .
platforms: linux/amd64, linux/arm64
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.idea
.dccache

src/*.js
dist
coverage
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
10 changes: 10 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "avoid"
}
Loading

0 comments on commit 900cf46

Please sign in to comment.